summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-02 02:15:17 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-02 02:15:17 +0000
commite94dd7ccf5064b0c7c650de1f28923de01adbafb (patch)
tree7cfed5547f6779290ec77805a80618db6e34afd9 /clang/lib/Sema
parent24a60cd2eb4b2a138ec83aa48686ce2b3b13085c (diff)
downloadbcm5719-llvm-e94dd7ccf5064b0c7c650de1f28923de01adbafb.tar.gz
bcm5719-llvm-e94dd7ccf5064b0c7c650de1f28923de01adbafb.zip
When adding a friend class declaration to the lookup tables, use the access specifier
of any previous declaration in case we replace it in a class's declaration table. Fixes bug 4858. This sort of thing makes me reconsider putting friend declarations in declaration lists. llvm-svn: 80750
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 86222ffe147..113283a6446 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4331,6 +4331,11 @@ CreateNewDecl:
if (TUK == TUK_Friend) {
// 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))
OpenPOWER on IntegriCloud