forked from OSchip/llvm-project
Borrow a friend class's previous declaration's access specifier regardless of
whether the current context is dependent. Thanks to Anders for pointing this out. llvm-svn: 80828
This commit is contained in:
parent
a7e8799c72
commit
f8bd861ce9
|
@ -4329,13 +4329,13 @@ CreateNewDecl:
|
|||
|
||||
// If this has an identifier, add it to the scope stack.
|
||||
if (TUK == TUK_Friend) {
|
||||
// We might be replacing an existing declaration in the lookup tables;
|
||||
// if so, borrow its access specifier.
|
||||
if (PrevDecl)
|
||||
New->setAccess(PrevDecl->getAccess());
|
||||
|
||||
// Friend tag decls are visible in fairly strange ways.
|
||||
if (!CurContext->isDependentContext()) {
|
||||
// We might be replacing an existing declaration in the lookup tables;
|
||||
// if so, borrow its access specifier.
|
||||
if (PrevDecl)
|
||||
New->setAccess(PrevDecl->getAccess());
|
||||
|
||||
DeclContext *DC = New->getDeclContext()->getLookupContext();
|
||||
DC->makeDeclVisibleInContext(New, /* Recoverable = */ false);
|
||||
if (Scope *EnclosingScope = getScopeForDeclContext(S, DC))
|
||||
|
|
|
@ -27,6 +27,9 @@ public:
|
|||
value_ += b.value_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
class Representation {};
|
||||
friend class Representation;
|
||||
};
|
||||
|
||||
class A {
|
||||
|
|
Loading…
Reference in New Issue