Class variable template

I have a question specifically about the behavior of clang when we declare a variable template within a class. What the Standard stated about it ( N4296::14/1 [temp] ):

The variable template in the class area is a static data template.

I thought that any variable template (static and non-static) would be declared as a static data template template. But in fact, clang prevented the declaration of a non-static data item template ever.

 template <class U> struct A { template <class T, const T& t> int a; //non-static data member template }; int main(){} 

Demo

My question is how to usually be treated. Does this mean that the compiler must declare any data element template as an element of a static data template implicitly?

+5
source share

Source: https://habr.com/ru/post/1213411/


All Articles