1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 template<int i> struct x { 3 static const int j = i; 4 x<j>* y; 5 }; 6 7 template<int i> 8 const int x<i>::j; 9 10 int array0[x<2>::j]; 11 12 template<typename T> 13 struct X0 { 14 static const unsigned value = sizeof(T); 15 }; 16 17 template<typename T> 18 const unsigned X0<T>::value; 19 20 int array1[X0<int>::value == sizeof(int)? 1 : -1]; 21 22 const unsigned& testX0() { return X0<int>::value; } 23 24 int array2[X0<int>::value == sizeof(int)? 1 : -1]; 25 26 template<typename T> 27 struct X1 { 28 static const unsigned value; 29 }; 30 31 template<typename T> 32 const unsigned X1<T>::value = sizeof(T); 33 34 int array3[X1<int>::value == sizeof(int)? 1 : -1]; // expected-error{{variable length array declaration not allowed at file scope}} 35