diff options
author | John McCall <rjmccall@apple.com> | 2009-09-02 19:32:14 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-09-02 19:32:14 +0000 |
commit | 82b9fb8e7a05066e690670d2eb386a624b04f684 (patch) | |
tree | 68ab9d456df5b89d8b32bbaff07e0f25304d3785 /lib/Sema/SemaDecl.cpp | |
parent | f4b5f5c6a1487317aab9aa30d97bccfd57c82c98 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 113283a644..e7a327805a 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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)) |