diff options
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/friend.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 79a5d4c98c..c8c3af3cd5 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -10060,7 +10060,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, // declarations should stop at the nearest enclosing namespace, // not that they should only consider the nearest enclosing // namespace. - while (DC->isRecord()) + while (DC->isRecord() || DC->isTransparentContext()) DC = DC->getParent(); LookupQualifiedName(Previous, DC); diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp index b1ef220e53..c5b11eb5a3 100644 --- a/test/SemaCXX/friend.cpp +++ b/test/SemaCXX/friend.cpp @@ -130,3 +130,11 @@ namespace test6_3 { v.f(); } } + +namespace test7 { + extern "C" { + class X { + friend int f() { return 42; } + }; + } +} |