diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-07 00:45:53 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-07 00:45:53 +0000 |
commit | 3d92d8c94e9447a6d903241e180590b4025c5927 (patch) | |
tree | 31fecf3dcac7416083138881ca7fa54369ebb3bc | |
parent | 5fe4d9deb543a19f557e3d85c5f33867af97cd96 (diff) |
More testing of explicit specializations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83440 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp | 40 |
1 files 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<typename T> -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<typename T> template<typename U> -void X0<T>::ft1(T t, U u) { +void N0::X0<T>::ft1(T t, U u) { t = u; } -template<typename T> T X0<T>::member; +template<typename T> T N0::X0<T>::member; -template<> struct X0<void> { }; -X0<void> test_X0; +template<> struct N0::X0<void> { }; // expected-error{{originally}} +N0::X0<void> test_X0; +namespace N1 { + template<> struct N0::X0<const void> { }; // expected-error{{originally}} +} + +namespace N0 { + template<> struct X0<volatile void>; +} + +template<> struct N0::X0<volatile void> { }; // -- member function of a class template -template<> void X0<void*>::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<void*>::f1(void *) { } -void test_spec(X0<void*> xvp, void *vp) { +void test_spec(N0::X0<void*> 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<NonDefaultConstructible>::member = 17; @@ -105,10 +121,4 @@ void X0<void*>::ft1(void*, const void*) { } void test_func_template(X0<void *> xvp, void *vp, const void *cvp) { xvp.ft1(vp, cvp); } - -// example from the standard: -template<class T> class stream; -template<> class stream<char> { /* ... */ }; -template<class T> class Array { /* ... */ }; -template<class T> void sort(Array<T>& v) { /* ... */ } -template<> void sort<char*>(Array<char*>&) ; +#endif |