1 // RUN: %clang_cc1 -std=c++98 -verify=cxx98 %s 2 // RUN: %clang_cc1 -std=c++11 -verify=cxx11 %s 3 // cxx11-no-diagnostics 4 5 template<int n> struct S; 6 7 template<int n> struct T { TT8 T() { 9 // An identifier is value-dependent if it is: 10 // - a name declared with a dependent type 11 S<n> s; 12 S<s> check1; // ok, s is value-dependent 13 // - the name of a non-type template parameter 14 typename S<n>::T check2; // ok, n is value-dependent 15 // - a constant with literal type and is initialized with an expression 16 // that is value-dependent. 17 const int k = n; 18 typename S<k>::T check3; // ok, k is value-dependent 19 20 const int &i = k; // cxx98-note {{declared here}} 21 typename S<i>::T check4; // cxx98-error {{not an integral constant expression}} cxx98-note {{read of variable 'i' of non-integral, non-enumeration type 'const int &'}} 22 } 23 }; 24