12bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith// RUN: %clang_cc1 -std=c++98 -verify %s 22bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith 32bbe2c63a93a1583631c1ff70299f630510754c2Richard Smithtemplate<int n> struct S; 42bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith 52bbe2c63a93a1583631c1ff70299f630510754c2Richard Smithtemplate<int n> struct T { 62bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith T() { 72bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith // An identifier is value-dependent if it is: 82bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith // - a name declared with a dependent type 92bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith S<n> s; 102bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith S<s> check1; // ok, s is value-dependent 112bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith // - the name of a non-type template parameter 122bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith typename S<n>::T check2; // ok, n is value-dependent 132bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith // - a constant with literal type and is initialized with an expression 142bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith // that is value-dependent. 152bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith const int k = n; 162bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith typename S<k>::T check3; // ok, u is value-dependent 172bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith 182bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith const int &i = k; 192bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith typename S<i>::T check4; // expected-error {{not an integral constant expression}} expected-error {{qualified name}} 202bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith } 212bbe2c63a93a1583631c1ff70299f630510754c2Richard Smith}; 22