The following code using static constexp on a class results in and undefined symbol the on the 12.5 linker but links fine in GCC, Clang and Visual C++.
test.h:
class Test {
public:
static constexpr auto CONST_VALUE = "const value";
static constexpr auto CONST_OTHER = "const other";
};
test.cpp:
#include <iostream>
#include "test.h"
int main() {
std::cout << Test::CONST_VALUE;
}
When compiled:
$ CC -std=c++11 test.cpp -o test
Undefined first referenced
symbol in file
Test::CONST_VALUE test.o
[Hint: static member Test::CONST_VALUE must be defined in the program]
Notice no compiler error is given when processing the header and that only for the variable being accessed in the cpp file gives an error at link time.
-Jake