Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Eli Friedman | c149412 | 2009-06-11 01:11:20 +0000 | [diff] [blame] | 3 | template<int i> struct x { |
| 4 | static const int j = i; |
| 5 | x<j>* y; |
| 6 | }; |
| 7 | |
Douglas Gregor | cf3293e | 2009-11-01 20:32:48 +0000 | [diff] [blame] | 8 | template<int i> |
| 9 | const int x<i>::j; |
| 10 | |
| 11 | int array0[x<2>::j]; |
| 12 | |
Douglas Gregor | cf3293e | 2009-11-01 20:32:48 +0000 | [diff] [blame] | 13 | template<typename T> |
| 14 | struct X0 { |
| 15 | static const unsigned value = sizeof(T); |
| 16 | }; |
| 17 | |
| 18 | template<typename T> |
| 19 | const unsigned X0<T>::value; |
| 20 | |
| 21 | int array1[X0<int>::value == sizeof(int)? 1 : -1]; |
| 22 | |
| 23 | const unsigned& testX0() { return X0<int>::value; } |
| 24 | |
| 25 | int array2[X0<int>::value == sizeof(int)? 1 : -1]; |
| 26 | |
| 27 | template<typename T> |
| 28 | struct X1 { |
| 29 | static const unsigned value; |
| 30 | }; |
| 31 | |
| 32 | template<typename T> |
| 33 | const unsigned X1<T>::value = sizeof(T); |
| 34 | |
Richard Smith | 3e9ea0b | 2011-12-21 00:25:33 +0000 | [diff] [blame] | 35 | int array3[X1<int>::value == sizeof(int)? 1 : -1]; |