Under -fms-extensions, only inject a friend tag name when we didn't see a tag with that name in an enclosing scope.
r177473 made us correctly consider only those declarations in the
enclosing namespace scope when looking for a friend declaration. Under
ms-extensions mode, where we do some level of friend injection, this
meant that we were introducing a new tag type into a different scope
than what Microsoft actually does. Address this by only doing the
friend injection when we didn't see any tag with that name in any
outer scope. Fixes <rdar://problem/14250378>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185100 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp
index e82c47e..723beb4 100644
--- a/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/test/SemaCXX/MicrosoftExtensions.cpp
@@ -365,3 +365,23 @@
struct StructWithUnnamedMember {
__declspec(property(get=GetV)) int : 10; // expected-error {{anonymous property is not supported}}
};
+
+namespace rdar14250378 {
+ class Bar {};
+
+ namespace NyNamespace {
+ class Foo {
+ public:
+ Bar* EnsureBar();
+ };
+
+ class Baz : public Foo {
+ public:
+ friend class Bar;
+ };
+
+ Bar* Foo::EnsureBar() {
+ return 0;
+ }
+ }
+}