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