18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -fsyntax-only -verify %s 2*c6e68daaSAndy Gibbs // expected-no-diagnostics 3dd49ee3fSEli Friedman template<int i> struct x { 4dd49ee3fSEli Friedman static const int j = i; 5dd49ee3fSEli Friedman x<j>* y; 6dd49ee3fSEli Friedman }; 7dd49ee3fSEli Friedman 80840cc02SDouglas Gregor template<int i> 90840cc02SDouglas Gregor const int x<i>::j; 100840cc02SDouglas Gregor 110840cc02SDouglas Gregor int array0[x<2>::j]; 120840cc02SDouglas Gregor 130840cc02SDouglas Gregor template<typename T> 140840cc02SDouglas Gregor struct X0 { 150840cc02SDouglas Gregor static const unsigned value = sizeof(T); 160840cc02SDouglas Gregor }; 170840cc02SDouglas Gregor 180840cc02SDouglas Gregor template<typename T> 190840cc02SDouglas Gregor const unsigned X0<T>::value; 200840cc02SDouglas Gregor 210840cc02SDouglas Gregor int array1[X0<int>::value == sizeof(int)? 1 : -1]; 220840cc02SDouglas Gregor testX0()230840cc02SDouglas Gregorconst unsigned& testX0() { return X0<int>::value; } 240840cc02SDouglas Gregor 250840cc02SDouglas Gregor int array2[X0<int>::value == sizeof(int)? 1 : -1]; 260840cc02SDouglas Gregor 270840cc02SDouglas Gregor template<typename T> 280840cc02SDouglas Gregor struct X1 { 290840cc02SDouglas Gregor static const unsigned value; 300840cc02SDouglas Gregor }; 310840cc02SDouglas Gregor 320840cc02SDouglas Gregor template<typename T> 330840cc02SDouglas Gregor const unsigned X1<T>::value = sizeof(T); 340840cc02SDouglas Gregor 35ed2974f3SRichard Smith int array3[X1<int>::value == sizeof(int)? 1 : -1]; 36