summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-11-28 05:15:46 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-11-28 05:15:46 +0000
commit02a84c8d0c8274b3a44f7f0c0268ea61b21321d9 (patch)
tree4e264d433bd18e8e42136cf4857a4bedcf5a5f2c
parent0614cff40d9fc3ba75c5099d1292c2c692300e0b (diff)
downloadbcm5719-llvm-02a84c8d0c8274b3a44f7f0c0268ea61b21321d9.tar.gz
bcm5719-llvm-02a84c8d0c8274b3a44f7f0c0268ea61b21321d9.zip
PR12884: Add test (bug is already fixed).
llvm-svn: 347729
-rw-r--r--clang/test/SemaTemplate/typename-specifier-3.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/typename-specifier-3.cpp b/clang/test/SemaTemplate/typename-specifier-3.cpp
index dfab5a0130f..dc9d00601d4 100644
--- a/clang/test/SemaTemplate/typename-specifier-3.cpp
+++ b/clang/test/SemaTemplate/typename-specifier-3.cpp
@@ -18,3 +18,59 @@ B c() {
template<class T> struct test2 { T b() { return typename T::a; } }; // expected-error{{expected '(' for function-style cast or type construction}}
template<class T> struct test3 { T b() { return typename a; } }; // expected-error{{expected a qualified name after 'typename'}}
template<class T> struct test4 { T b() { return typename ::a; } }; // expected-error{{refers to non-type member}} expected-error{{expected '(' for function-style cast or type construction}}
+
+// PR12884
+namespace PR12884_original {
+ template <typename T> struct A {
+ struct B {
+ template <typename U> struct X {};
+ typedef int arg;
+ };
+ struct C {
+ typedef B::X<typename B::arg> x; // expected-error {{missing 'typename'}}
+ };
+ };
+
+ template <> struct A<int>::B {
+ template <int N> struct X {};
+ static const int arg = 0;
+ };
+
+ A<int>::C::x a;
+}
+namespace PR12884_half_fixed {
+ template <typename T> struct A {
+ struct B {
+ template <typename U> struct X {};
+ typedef int arg;
+ };
+ struct C {
+ typedef typename B::X<typename B::arg> x; // expected-error {{use 'template'}} expected-error {{refers to non-type}}
+ };
+ };
+
+ template <> struct A<int>::B {
+ template <int N> struct X {};
+ static const int arg = 0; // expected-note {{here}}
+ };
+
+ A<int>::C::x a; // expected-note {{here}}
+}
+namespace PR12884_fixed {
+ template <typename T> struct A {
+ struct B {
+ template <typename U> struct X {};
+ typedef int arg;
+ };
+ struct C {
+ typedef typename B::template X<B::arg> x;
+ };
+ };
+
+ template <> struct A<int>::B {
+ template <int N> struct X {};
+ static const int arg = 0;
+ };
+
+ A<int>::C::x a; // ok
+}
OpenPOWER on IntegriCloud