summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/class-template-decl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-04-21 01:27:54 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-04-21 01:27:54 +0000
commit6483d22f1b0be9d7ce08689c83f6fa3cb7ac33e0 (patch)
tree850fcdd40a0e46b0eeb6f77ce343bf564383aceb /clang/test/SemaTemplate/class-template-decl.cpp
parentd9f244afbbca105b644798902606f2e59e2ebd84 (diff)
downloadbcm5719-llvm-6483d22f1b0be9d7ce08689c83f6fa3cb7ac33e0.tar.gz
bcm5719-llvm-6483d22f1b0be9d7ce08689c83f6fa3cb7ac33e0.zip
When declaring a template, check that the context doesn't already contain a
declaration of the same name. r155187 caused us to miss this if the prior declaration did not declare a type. llvm-svn: 155269
Diffstat (limited to 'clang/test/SemaTemplate/class-template-decl.cpp')
-rw-r--r--clang/test/SemaTemplate/class-template-decl.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/class-template-decl.cpp b/clang/test/SemaTemplate/class-template-decl.cpp
index bd2accee3c2..23385a701e3 100644
--- a/clang/test/SemaTemplate/class-template-decl.cpp
+++ b/clang/test/SemaTemplate/class-template-decl.cpp
@@ -94,3 +94,46 @@ namespace rdar9676205 {
};
};
}
+
+namespace redecl {
+ int A; // expected-note {{here}}
+ template<typename T> struct A; // expected-error {{different kind of symbol}}
+
+ int B;
+ template<typename T> struct B { // expected-error {{different kind of symbol}}
+ };
+
+ template<typename T> struct F;
+ template<typename T> struct K;
+
+ int G, H;
+
+ struct S {
+ int C; // expected-note {{here}}
+ template<typename T> struct C; // expected-error {{different kind of symbol}}
+
+ int D;
+ template<typename T> struct D { // expected-error {{different kind of symbol}}
+ };
+
+ int E;
+ template<typename T> friend struct E { // expected-error {{cannot define a type in a friend}}
+ };
+
+ int F;
+ template<typename T> friend struct F; // ok, redecl::F
+
+ template<typename T> struct G; // ok
+
+ template<typename T> friend struct H; // expected-error {{different kind of symbol}}
+
+ int I, J, K;
+
+ struct U {
+ template<typename T> struct I; // ok
+ template<typename T> struct J { // ok
+ };
+ template<typename T> friend struct K; // ok, redecl::K
+ };
+ };
+}
OpenPOWER on IntegriCloud