aboutsummaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-08 07:24:58 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-08 07:24:58 +0000
commit251b4ff2578e26959a4c036140ccd61c5e9292f2 (patch)
treecacc1f2c9bfb3174e9914422eef9de64890b06cd /test/CXX
parente9374d5e2c0915bd883dfa988db2451b844390d8 (diff)
For instantiations of static data members of class templates, keep
track of the kind of specialization or instantiation. Also, check the scope of the specialization and ensure that a specialization declaration without an initializer is not a definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
index 413d0b949d..438c41159a 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
@@ -49,7 +49,7 @@ namespace N0 {
template<typename T>
struct X0 { // expected-note 2{{here}}
- static T member;
+ static T member; // expected-note{{here}}
void f1(T t) { // expected-note{{explicitly specialized declaration is here}}
t = 17;
@@ -106,16 +106,27 @@ void test_x0_cvvoid(N0::X0<const volatile void*> x0, const volatile void *cvp) {
x0.f1(cvp); // okay: we've explicitly specialized
}
-#if 0
-// FIXME: update the remainder of this test to check for scopes properly.
// -- static data member of a class template
-template<>
-NonDefaultConstructible X0<NonDefaultConstructible>::member = 17;
+namespace N0 {
+ // This actually tests p15; the following is a declaration, not a definition.
+ template<>
+ NonDefaultConstructible X0<NonDefaultConstructible>::member;
+
+ template<> long X0<long>::member = 17;
+
+ template<> float X0<float>::member;
+}
NonDefaultConstructible &get_static_member() {
- return X0<NonDefaultConstructible>::member;
+ return N0::X0<NonDefaultConstructible>::member;
}
+template<> int N0::X0<int>::member; // expected-error{{originally}}
+
+template<> float N0::X0<float>::member = 3.14f;
+
+#if 0
+// FIXME: update the remainder of this test to check for scopes properly.
// -- member class of a class template
template<>
struct X0<void*>::Inner { };