Using N3651 as a basis,
A variable template at class scope is a static data member template.
The example given is:>
If you try the first example, clang coughs up the magic error right away:
template
struct hermitian_matrix { };
struct foo
{
template
using pauli = hermitian_matrix;
template
constexpr pauli sigma1 = { { 0, 1 }, { 1, 0 } };
};
error: non-static data member cannot be constexpr; did you intend to make it static?
Apparently at class scope, variable templates need to be declared static. clang doesn't cough up the right error unless you declare it constexpr, which can be misleading. As well as that, their example of a static data member:
struct foo
{
template
static T bar;
};
template
T foo::bar = T{3.14};
may throw you off because one might think that the whole point of variable member templates is to replace static data members.