diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-04 21:37:14 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-04 21:37:14 +0000 |
commit | 8b6070bb9df4703bc59f26803f46695cfb64fd1b (patch) | |
tree | 687bbd21a0df91a5bfcae05f0bc28e487fb99bf0 /clang/test/SemaTemplate/nested-name-spec-template.cpp | |
parent | d7e1bb80a9579155c853741d4baee9b321d4d8de (diff) | |
download | bcm5719-llvm-8b6070bb9df4703bc59f26803f46695cfb64fd1b.tar.gz bcm5719-llvm-8b6070bb9df4703bc59f26803f46695cfb64fd1b.zip |
Teach Sema::ActOnCXXNestedNameSpecifier and Sema::CheckTemplateIdType
to cope with non-type templates by providing appropriate
errors. Previously, we would either assert, crash, or silently build a
dependent type when we shouldn't. Fixes PR9226.
llvm-svn: 127037
Diffstat (limited to 'clang/test/SemaTemplate/nested-name-spec-template.cpp')
-rw-r--r-- | clang/test/SemaTemplate/nested-name-spec-template.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/nested-name-spec-template.cpp b/clang/test/SemaTemplate/nested-name-spec-template.cpp index 9c72845fb6a..7730ee395f4 100644 --- a/clang/test/SemaTemplate/nested-name-spec-template.cpp +++ b/clang/test/SemaTemplate/nested-name-spec-template.cpp @@ -99,3 +99,31 @@ namespace PR7725 { } }; } + +namespace PR9226 { + template<typename a> + void nt() // expected-note{{function template 'nt' declared here}} + { nt<>:: } // expected-error{{qualified name refers into a specialization of function template 'nt'}} \ + // expected-error{{expected unqualified-id}} + + template<typename T> + void f(T*); // expected-note{{function template 'f' declared here}} + + template<typename T> + void f(T*, T*); // expected-note{{function template 'f' declared here}} + + void g() { + f<int>:: // expected-error{{qualified name refers into a specialization of function template 'f'}} + } // expected-error{{expected unqualified-id}} + + struct X { + template<typename T> void f(); // expected-note{{function template 'f' declared here}} + }; + + template<typename T, typename U> + struct Y { + typedef typename T::template f<U> type; // expected-error{{template name refers to non-type template 'X::f'}} + }; + + Y<X, int> yxi; // expected-note{{in instantiation of template class 'PR9226::Y<PR9226::X, int>' requested here}} +} |