PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / var-templ2.C
blobc734f413145281fedd9dd043bae2499716cebaea
1 // { dg-do compile { target c++14 } }
3 // Template variables and static member variables of template classes are
4 // often confused.
6 template<typename T>
7   struct S1
8   {
9     static int n;
10     static int arr[];
11   };
13 template<typename T>
14   constexpr int var = sizeof (T);
16 template<typename T>
17   int S1<T>::n = sizeof (T);
19 template<typename T>
20   int S1<T>::arr[sizeof (T)];
22 template<>
23   int S1<int>::n = 8;
25 template<>
26   int S1<int>::arr[8];
28 int main ()
30   S1<int> v1;
31   var<S1<int>>;
32   return 0;