Douglas Gregor | 3d7a12a | 2009-03-25 23:32:15 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | template<typename T, T Divisor> |
| 4 | class X { |
| 5 | public: |
| 6 | static const T value = 10 / Divisor; // expected-error{{in-class initializer is not an integral constant expression}} |
| 7 | }; |
| 8 | |
| 9 | int array1[X<int, 2>::value == 5? 1 : -1]; |
| 10 | X<int, 0> xi0; // expected-note{{in instantiation of template class 'class X<int, 0>' requested here}} |
| 11 | |
| 12 | |
| 13 | template<typename T> |
| 14 | class 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 | |
| 18 | Y<float> fy; // expected-note{{in instantiation of template class 'class Y<float>' requested here}} |