I'm trying to understand if what I'm seeing is an MSVC compiler bug or a misunderstanding on my part. I'm trying to use a simple compile-time string literal template parameter, like so:
constexpr const char teststr[] = "teststr";
template <const char *N>
struct Test {
static constexpr const char *name = N;
};
using TEST = Test<teststr>;
However, MSVC reports that the teststr parameter is not a compile-time expression: error C2975: 'Test': invalid template argument for 'N', expected compile-time constant expression (on the using TEST line).
Is this my mistake, or a compiler bug? I am using Visual Studio 2017 version 15.1.