[PATCH] D24904: Allow StringRef to be constructed with a null pointer
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 26 13:02:14 PDT 2016
zturner added a comment.
In https://reviews.llvm.org/D24904#552834, @lattner wrote:
> You should be able to make string literals work if you use a template that takes an array of char with the size as a template parameter.
I thought so too, but in my tests given:
template<unsigned N>
void foo(const char (&S)[N]) { }
void foo(const char *S) { }
I could never get the compiler to invoke the first one, no matter what I passed in. It's possible I was missing some subtlety though, I'll just try it with Mehdi's forthcoming patch and see what I get.
https://reviews.llvm.org/D24904
More information about the llvm-commits
mailing list