aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/temp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-08 15:54:21 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-08 15:54:21 +0000
commit741fab61570f145a52b808a6824841c41e892c28 (patch)
treeee296c45c0bd51f31c756929ba59da282ae69cc5 /test/CXX/temp
parent42887b9224e1d47372fb8a00cba27c925924fa52 (diff)
Don't complain about out-of-line explicit specializations of member
function and member function templates that are not definitions. Add more tests to ensure that explicit specializations of member function templates prevent instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/temp')
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp39
1 files changed, 31 insertions, 8 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 9c6c5edc50..64856605a0 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
@@ -62,7 +62,7 @@ struct X0 { // expected-note 2{{here}}
// expected-error{{base specifier}}
template<typename U>
- void ft1(T t, U u);
+ void ft1(T t, U u); // expected-note{{explicitly specialized}}
};
}
@@ -203,14 +203,37 @@ 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<>
-void X0<void*>::ft1(void*, const void*) { }
+namespace N0 {
+ template<>
+ template<>
+ void X0<void*>::ft1(void*, const void*) { }
+
+ template<> template<>
+ void X0<void*>::ft1(void *, int);
+
+ template<> template<>
+ void X0<void*>::ft1(void *, unsigned);
+
+ template<> template<>
+ void X0<void*>::ft1(void *, long);
+}
+
+template<> template<>
+void N0::X0<void*>::ft1(void *, unsigned) { } // okay
+
+template<> template<>
+void N0::X0<void*>::ft1(void *, float) { } // expected-error{{function template specialization}}
+
+namespace N1 {
+ template<> template<>
+ void N0::X0<void*>::ft1(void *, long) { } // expected-error{{enclosing}}
+}
+
-void test_func_template(X0<void *> xvp, void *vp, const void *cvp) {
+void test_func_template(N0::X0<void *> xvp, void *vp, const void *cvp,
+ int i, unsigned u) {
xvp.ft1(vp, cvp);
+ xvp.ft1(vp, i);
+ xvp.ft1(vp, u);
}
-#endif