diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp | 6 | ||||
-rw-r--r-- | clang/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp | 30 |
2 files changed, 35 insertions, 1 deletions
diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp index 112444af954..04129f8091f 100644 --- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp +++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp @@ -7,10 +7,14 @@ template<class T1> class A { }; template<> template<class X> -class A<int>::B { }; +class A<long>::B { }; +// FIXME: If we make the explicit specialization of A<long>::B, above, into +// a specialization of A<int>::B, our diagnostic is correct but not very +// helpful. template<> template<> template<class T> void A<int>::B<double>::mf1(T t) { } +// FIXME: This diagnostic could probably be better. template<class Y> template<> void A<Y>::B<double>::mf2() { } // expected-error{{does not refer}} diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp new file mode 100644 index 00000000000..1f38e5a2c17 --- /dev/null +++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp @@ -0,0 +1,30 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<typename T> +struct X { + template<typename U> struct Inner { }; + + template<typename U> void f(T, U) { } +}; + +template<> template<typename U> +struct X<int>::Inner { + U member; +}; + +template<> template<typename U> +void X<int>::f(int x, U y) { + x = y; // expected-error{{incompatible type}} +} + +void test(X<int> xi, X<long> xl, float *fp) { + X<int>::Inner<float*> xii; + xii.member = fp; + xi.f(17, 25); + xi.f(17, 3.14159); + xi.f(17, fp); // expected-note{{instantiation}} + X<long>::Inner<float*> xli; + + xli.member = fp; // expected-error{{no member}} + xl.f(17, fp); // okay +} |