diff options
Diffstat (limited to 'test/SemaTemplate/instantiate-method.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-method.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-method.cpp b/test/SemaTemplate/instantiate-method.cpp index 58cb897..9618844 100644 --- a/test/SemaTemplate/instantiate-method.cpp +++ b/test/SemaTemplate/instantiate-method.cpp @@ -182,3 +182,28 @@ namespace SameSignatureAfterInstantiation { }; S<const int> s; // expected-note {{instantiation}} } + +namespace PR22040 { + template <typename T> struct Foobar { + template <> void bazqux(typename T::type) {} // expected-error {{cannot specialize a function 'bazqux' within class scope}} expected-error 2{{cannot be used prior to '::' because it has no members}} + }; + + void test() { + // FIXME: we should suppress the "no member" errors + Foobar<void>::bazqux(); // expected-error{{no member named 'bazqux' in }} expected-note{{in instantiation of template class }} + Foobar<int>::bazqux(); // expected-error{{no member named 'bazqux' in }} expected-note{{in instantiation of template class }} + Foobar<int>::bazqux(3); // expected-error{{no member named 'bazqux' in }} + } +} + +template <typename> +struct SpecializationOfGlobalFnInClassScope { + template <> + void ::Fn(); // expected-error{{cannot have a qualified name}} +}; + +class AbstractClassWithGlobalFn { + template <typename> + void ::f(); // expected-error{{cannot have a qualified name}} + virtual void f1() = 0; +}; |