// RUN: clang-cc -fsyntax-only -verify %s template class X { public: static const T value = 10 / Divisor; // expected-error{{in-class initializer is not an integral constant expression}} }; int array1[X::value == 5? 1 : -1]; X xi0; // expected-note{{in instantiation of template class 'class X' requested here}} template class Y { static const T value = 0; // expected-error{{'value' can only be initialized if it is a static const integral data member}} }; Y fy; // expected-note{{in instantiation of template class 'class Y' requested here}} // out-of-line static member variables template struct Z { static T value; }; template T Z::value; // expected-error{{no matching constructor}} struct DefCon {}; struct NoDefCon { NoDefCon(const NoDefCon&); }; void test() { DefCon &DC = Z::value; NoDefCon &NDC = Z::value; // expected-note{{instantiation}} } // PR5609 struct X1 { ~X1(); // The errors won't be triggered without this dtor. }; template struct Y1 { static char Helper(T); static const int value = sizeof(Helper(T())); }; struct X2 { virtual ~X2(); }; namespace std { class type_info { }; } template struct Y2 { static T &Helper(); static const int value = sizeof(typeid(Helper())); }; template struct Z1 {}; void Test() { Z1::value> x; int y[Y1::value]; Z1::value> x2; int y2[Y2::value]; }