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