blob: 99e6b9cc06c375d962586721b18d9733e375e7ad [file] [log] [blame]
Douglas Gregor3d7a12a2009-03-25 23:32:15 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3template<typename T, T Divisor>
4class X {
5public:
6 static const T value = 10 / Divisor; // expected-error{{in-class initializer is not an integral constant expression}}
7};
8
9int array1[X<int, 2>::value == 5? 1 : -1];
10X<int, 0> xi0; // expected-note{{in instantiation of template class 'class X<int, 0>' requested here}}
11
12
13template<typename T>
14class Y {
15 static const T value = 0; // expected-error{{'value' can only be initialized if it is a static const integral data member}}
16};
17
18Y<float> fy; // expected-note{{in instantiation of template class 'class Y<float>' requested here}}