forked from OSchip/llvm-project
Skip through transparent contexts when deciding where to add a friend function.
This fixes g++.dg/parse/friend5.C. llvm-svn: 152938
This commit is contained in:
parent
7bfe2b5a4a
commit
af0cc7fd27
|
@ -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);
|
||||
|
|
|
@ -130,3 +130,11 @@ namespace test6_3 {
|
|||
v.f();
|
||||
}
|
||||
}
|
||||
|
||||
namespace test7 {
|
||||
extern "C" {
|
||||
class X {
|
||||
friend int f() { return 42; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue