From 3d92d8c94e9447a6d903241e180590b4025c5927 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 7 Oct 2009 00:45:53 +0000 Subject: [PATCH] More testing of explicit specializations git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83440 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 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 3bc0a07c96..7b50518605 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp @@ -38,10 +38,11 @@ namespace N1 { template<> void N0::f0(double) { } // expected-error{{originally be declared}} -// FIXME: update the remainder of this test to check for scopes properly. // -- class template +namespace N0 { + template -struct X0 { +struct X0 { // expected-note 2{{here}} static T member; void f1(T t) { @@ -57,25 +58,40 @@ struct X0 { void ft1(T t, U u); }; +} + template template -void X0::ft1(T t, U u) { +void N0::X0::ft1(T t, U u) { t = u; } -template T X0::member; +template T N0::X0::member; -template<> struct X0 { }; -X0 test_X0; +template<> struct N0::X0 { }; // expected-error{{originally}} +N0::X0 test_X0; +namespace N1 { + template<> struct N0::X0 { }; // expected-error{{originally}} +} + +namespace N0 { + template<> struct X0; +} + +template<> struct N0::X0 { }; // -- member function of a class template -template<> void X0::f1(void *) { } +// FIXME: this should complain about the scope of f1, but we don't seem +// to recognize it as a specialization. Hrm? +template<> void N0::X0::f1(void *) { } -void test_spec(X0 xvp, void *vp) { +void test_spec(N0::X0 xvp, void *vp) { xvp.f1(vp); } +#if 0 +// FIXME: update the remainder of this test to check for scopes properly. // -- static data member of a class template template<> NonDefaultConstructible X0::member = 17; @@ -105,10 +121,4 @@ void X0::ft1(void*, const void*) { } void test_func_template(X0 xvp, void *vp, const void *cvp) { xvp.ft1(vp, cvp); } - -// example from the standard: -template class stream; -template<> class stream { /* ... */ }; -template class Array { /* ... */ }; -template void sort(Array& v) { /* ... */ } -template<> void sort(Array&) ; +#endif -- 2.40.0