[cfe-commits] r144060 - in /cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr: p2-0x.cpp p2.cpp

Richard Smith richard-llvm at metafoo.co.uk
Mon Nov 7 18:18:13 PST 2011


Author: rsmith
Date: Mon Nov  7 20:18:13 2011
New Revision: 144060

URL: http://llvm.org/viewvc/llvm-project?rev=144060&view=rev
Log:
Some tests missed from r144056.

Added:
    cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
    cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp

Added: cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp?rev=144060&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2-0x.cpp Mon Nov  7 20:18:13 2011
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s
+
+template<int n> struct S;
+
+template<int n> struct T {
+  T() {
+    // An identifier is value-dependent if it is:
+    //  - a name declared with a dependent type
+    S<n> s;
+    S<s> check1; // ok, s is value-dependent
+    //  - the name of a non-type template parameter
+    typename S<n>::T check2; // ok, n is value-dependent
+    //  - a constant with literal type and is initialized with an expression
+    //  that is value-dependent.
+    const int k = n;
+    typename S<k>::T check3a; // ok, u is value-dependent
+
+    constexpr const int *p = &k;
+    typename S<*p>::T check3b; // ok, p is value-dependent
+
+    // (missing from the standard)
+    //  - a reference and is initialized with an expression that is
+    //  value-dependent.
+    const int &i = k;
+    typename S<i>::T check4; // ok, i is value-dependent
+  }
+};

Added: cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp?rev=144060&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp Mon Nov  7 20:18:13 2011
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -std=c++98 -verify %s
+
+template<int n> struct S;
+
+template<int n> struct T {
+  T() {
+    // An identifier is value-dependent if it is:
+    //  - a name declared with a dependent type
+    S<n> s;
+    S<s> check1; // ok, s is value-dependent
+    //  - the name of a non-type template parameter
+    typename S<n>::T check2; // ok, n is value-dependent
+    //  - a constant with literal type and is initialized with an expression
+    //  that is value-dependent.
+    const int k = n;
+    typename S<k>::T check3; // ok, u is value-dependent
+
+    const int &i = k;
+    typename S<i>::T check4; // expected-error {{not an integral constant expression}} expected-error {{qualified name}}
+  }
+};





More information about the cfe-commits mailing list