[PATCH] D24904: Allow StringRef to be constructed with a null pointer

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 10:59:28 PDT 2016


clayborg added a subscriber: clayborg.
clayborg added a comment.

Can we either leave in the:

  StringRef(std::nullptr_t) = delete;

Or make the "const char *" constructor explicit? If we don't, we can end up getting default constructed StringRef objects when we don't expect them like in:

  StringRef a("hello");
  if (a == nullptr) { ... }
  if (a == NULL) { ... }


https://reviews.llvm.org/D24904





More information about the llvm-commits mailing list