summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-12-04 00:56:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-12-04 00:56:29 +0000
commit8f65806b35e7bc476b3a84a694b9cedb57eba1e6 (patch)
tree0d9376eaec9461f7babc215e75bb48106212964b /clang/test
parent0e7f6da674c2870bc69fdd2a6b3fcaf49bbdd5f5 (diff)
downloadbcm5719-llvm-8f65806b35e7bc476b3a84a694b9cedb57eba1e6.tar.gz
bcm5719-llvm-8f65806b35e7bc476b3a84a694b9cedb57eba1e6.zip
Fix crash if a dependent template-id was assumed to be a type but instantiates
to a variable template specialization. llvm-svn: 196337
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
index 1e959364280..1e5e834b6d2 100644
--- a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
+++ b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
@@ -291,6 +291,30 @@ namespace in_class_template {
template<typename T> template<typename...U> T A<T>::y<tuple<U...> >[] = { U()... };
static_assert(sizeof(A<int>::y<tuple<char, char, char> >) == 12, "");
}
+
+ namespace bad_reference {
+ struct S {
+ template<typename T> static int A; // expected-note 4{{here}}
+ };
+
+ template<typename T> void f() {
+ typename T::template A<int> a; // expected-error {{template name refers to non-type template 'S::A'}}
+ }
+ template<typename T> void g() {
+ T::template A<int>::B = 0; // expected-error {{template name refers to non-type template 'S::A'}}
+ }
+ template<typename T> void h() {
+ class T::template A<int> c; // expected-error {{template name refers to non-type template 'S::A'}}
+ }
+
+ template<typename T>
+ struct X : T::template A<int> {}; // expected-error {{template name refers to non-type template 'S::A'}}
+
+ template void f<S>(); // expected-note {{in instantiation of}}
+ template void g<S>(); // expected-note {{in instantiation of}}
+ template void h<S>(); // expected-note {{in instantiation of}}
+ template struct X<S>; // expected-note {{in instantiation of}}
+ }
}
namespace in_nested_classes {
OpenPOWER on IntegriCloud