summaryrefslogtreecommitdiffstats
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
commit56f453563440024d1beffe7fa20e81a358b31d0a (patch)
treec8af6e22117197e526ea72e109a1e9d22fe03fbe
parent6816973723590ece2b7e77f4b3c9c14153fb4bc8 (diff)
downloadbcm5719-llvm-56f453563440024d1beffe7fa20e81a358b31d0a.tar.gz
bcm5719-llvm-56f453563440024d1beffe7fa20e81a358b31d0a.zip
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; }; llvm-svn: 283235
-rw-r--r--clang/test/SemaCXX/elaborated-type-specifier.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/elaborated-type-specifier.cpp b/clang/test/SemaCXX/elaborated-type-specifier.cpp
index 81c5cb4eac5..3701dd7ba63 100644
--- a/clang/test/SemaCXX/elaborated-type-specifier.cpp
+++ b/clang/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}}
+};
+}
OpenPOWER on IntegriCloud