Calling inherited constexpr constructor compiles fine with normal initialization but fails when constructing array:
#include <cstddef>
class StringRef {
const char* str;
size_t len;
public:
constexpr StringRef(const char* s, size_t l): str{s}, len{l} { }
};
class StringLiteral: public StringRef {
public:
template<size_t N>
constexpr StringLiteral(const char (&str)[N]): StringRef{str, N-1}
{
}
};
constexpr StringLiteral ok("abcd"); // this works fine
constexpr StringLiteral fail[] = {"abcd"}; // the error comes from here
CC -std=c++14 test.cpp
"test.cpp", line 13: Error: Cannot use unsigned long to initialize const char*.
1 Error(s) detected.
Studio 12.5 compiles this example fine
Also it seems that 12.6 compiles without errors if fail[] is not constexpr