blob: 7cdeda6fb9dae13eb7c0140137cee69bdd588c0b [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00002// expected-no-diagnostics
Eli Friedmanc1494122009-06-11 01:11:20 +00003template<int i> struct x {
4 static const int j = i;
5 x<j>* y;
6};
7
Douglas Gregorcf3293e2009-11-01 20:32:48 +00008template<int i>
9const int x<i>::j;
10
11int array0[x<2>::j];
12
Douglas Gregorcf3293e2009-11-01 20:32:48 +000013template<typename T>
14struct X0 {
15 static const unsigned value = sizeof(T);
16};
17
18template<typename T>
19const unsigned X0<T>::value;
20
21int array1[X0<int>::value == sizeof(int)? 1 : -1];
22
23const unsigned& testX0() { return X0<int>::value; }
24
25int array2[X0<int>::value == sizeof(int)? 1 : -1];
26
27template<typename T>
28struct X1 {
29 static const unsigned value;
30};
31
32template<typename T>
33const unsigned X1<T>::value = sizeof(T);
34
Richard Smith3e9ea0b2011-12-21 00:25:33 +000035int array3[X1<int>::value == sizeof(int)? 1 : -1];