summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/elaborated-type-specifier.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-10-04 18:10:23 +0000
committerReid Kleckner <rnk@google.com>2016-10-04 18:10:23 +0000
commit4e216152e2101410e5ee7f751454004bf4556086 (patch)
tree009798abcda414047859d9c36fc73440d06c0f53 /test/SemaCXX/elaborated-type-specifier.cpp
parent8e29175a33b3d04590df368b2a4279002a29fa44 (diff)
Test what happens when tag lookup and redeclaration lookup disagree
Clang has a diagnostic for the what happens when an elaborated type implicitly creates a tag declaration and the initial tag lookup fails, but the redeclaration lookup succeeds and finds a non-tag type. However, it wasn't tested, and looked like dead code. After much staring, we discovered how to exercise it, and are now committing the test for posterity. In this example, the tag lookup will not find A, but then when we go to insert a declaration of A at global scope, we discover the template friend, which is not a tag type. struct C { template <typename> friend struct A; }; struct B { struct A *p; }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/elaborated-type-specifier.cpp')
-rw-r--r--test/SemaCXX/elaborated-type-specifier.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp
index 81c5cb4eac..3701dd7ba6 100644
--- a/test/SemaCXX/elaborated-type-specifier.cpp
+++ b/test/SemaCXX/elaborated-type-specifier.cpp
@@ -52,3 +52,12 @@ namespace test5 {
}
};
}
+
+namespace test6 {
+struct C {
+ template <typename> friend struct A; // expected-note {{'A' declared here}}
+};
+struct B {
+ struct A *p; // expected-error {{implicit declaration introduced by elaborated type conflicts with a template of the same name}}
+};
+}