1aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith// RUN: %clang_cc1 -std=c++11 -verify %s 28e8fb3be5bd78f0564444eca02b404566a5f3b5dAndy Gibbs// expected-no-diagnostics 3aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith 4aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smithtemplate<int n> struct S; 5aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith 6aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smithtemplate<int n> struct T { 7aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith T() { 8aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // An identifier is value-dependent if it is: 9aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // - a name declared with a dependent type 10aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith S<n> s; 11aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith S<s> check1; // ok, s is value-dependent 12aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // - the name of a non-type template parameter 13aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith typename S<n>::T check2; // ok, n is value-dependent 14aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // - a constant with literal type and is initialized with an expression 15aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // that is value-dependent. 16aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith const int k = n; 17aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith typename S<k>::T check3a; // ok, u is value-dependent 18aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith 19aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith constexpr const int *p = &k; 20aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith typename S<*p>::T check3b; // ok, p is value-dependent 21aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith 22aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // (missing from the standard) 23aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // - a reference and is initialized with an expression that is 24aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith // value-dependent. 25aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith const int &i = k; 26aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith typename S<i>::T check4; // ok, i is value-dependent 27aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith } 28aa9aa3bfcd843caf2612726aa9115b30e7006348Richard Smith}; 29