У меня есть класс шаблона CRTP:
template <typename S>
class Base
{
public:
constexpr static S NOT_SET{0};
};
struct Derived : public Base<Derived>
{
};
Clang (5.0.0) не принимает это:
5 : <source>:5:24: error: constexpr variable cannot have non-literal type 'const Derived'
constexpr static S NOT_SET{0};
^
8 : <source>:8:25: note: in instantiation of template class 'Base<Derived>' requested here
struct Derived : public Base<Derived>
^
5 : <source>:5:24: note: incomplete type 'const Derived' is not a literal type
constexpr static S NOT_SET{0};
^
8 : <source>:8:8: note: definition of 'Derived' is not complete until the closing '}'
struct Derived : public Base<Derived>
^
1 error generated.
Compiler exited with result code 1
Но gcc (проверено на 4.9.2 и 6.2) нормально его принимает.
Как это сделать в clang?