summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-08 15:27:05 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-08 15:27:05 +0000
commit1e9b25caf4e0a8115e6564c3ca7dc7285c3b21f3 (patch)
tree986b7ad53126131855ae3e190928d4b7606ae269 /clang
parentbbe8f466211771b1a96b1eede898f9380b14dd6f (diff)
downloadbcm5719-llvm-1e9b25caf4e0a8115e6564c3ca7dc7285c3b21f3.tar.gz
bcm5719-llvm-1e9b25caf4e0a8115e6564c3ca7dc7285c3b21f3.zip
More testing for explicit specializations of member class templates
llvm-svn: 83548
Diffstat (limited to 'clang')
-rw-r--r--clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp40
1 files changed, 33 insertions, 7 deletions
diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
index 0ba95d875ad..9c6c5edc504 100644
--- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
+++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
@@ -58,7 +58,8 @@ struct X0 { // expected-note 2{{here}}
struct Inner : public T { }; // expected-note 3{{here}}
template<typename U>
- struct InnerTemplate : public T { };
+ struct InnerTemplate : public T { }; // expected-note 2{{explicitly specialized}} \
+ // expected-error{{base specifier}}
template<typename U>
void ft1(T t, U u);
@@ -170,15 +171,40 @@ N0::X0<long>::Inner inner2;
N0::X0<float>::Inner inner3;
N0::X0<double>::Inner inner4; // expected-error{{incomplete}}
-#if 0
-// FIXME: update the remainder of this test to check for scopes properly.
// -- member class template of a class template
-template<>
-template<>
-struct X0<void*>::InnerTemplate<int> { };
+namespace N0 {
+ template<>
+ template<>
+ struct X0<void*>::InnerTemplate<int> { };
+
+ template<> template<>
+ struct X0<int>::InnerTemplate<int>; // expected-note{{forward declaration}}
+
+ template<> template<>
+ struct X0<int>::InnerTemplate<long>;
-X0<void*>::InnerTemplate<int> inner_template0;
+ template<> template<>
+ struct X0<int>::InnerTemplate<double>;
+}
+
+template<> template<>
+struct N0::X0<int>::InnerTemplate<long> { }; // okay
+
+template<> template<>
+struct N0::X0<int>::InnerTemplate<float> { }; // expected-error{{class template specialization}}
+namespace N1 {
+ template<> template<>
+ struct N0::X0<int>::InnerTemplate<double> { }; // expected-error{{enclosing}}
+}
+
+N0::X0<void*>::InnerTemplate<int> inner_template0;
+N0::X0<int>::InnerTemplate<int> inner_template1; // expected-error{{incomplete}}
+N0::X0<int>::InnerTemplate<long> inner_template2;
+N0::X0<int>::InnerTemplate<unsigned long> inner_template3; // expected-note{{instantiation}}
+
+#if 0
+// FIXME: update the remainder of this test to check for scopes properly.
// -- member function template of a class template
template<>
template<>
OpenPOWER on IntegriCloud