The following fails to compile under both gcc and clang in c++14, but succeeds with c++1z:
struct Cls {
static constexpr int N = 0;
};
constexpr int Cls::N;
constexpr int Cls::N;
The C++14 error is predictable: redefinition of ‘constexpr const int Cls::N’
What changed to make this legal? I found:
n4659 10.1.5 [dcl.constexpr]
A function or static data member declared with the constexpr specifier is implicitly an inline function or variable
So I thought it might have to do with inline variables, but the following fails for c++1z under both compilers
struct Cls {
static inline const int N = 0;
};
inline const int Cls::N; // note, only one definition here