[cfe-commits] r80828 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/CXX/temp/temp.decls/temp.friend/p1.cpp
John McCall
rjmccall at apple.com
Wed Sep 2 12:32:15 PDT 2009
Author: rjmccall
Date: Wed Sep 2 14:32:14 2009
New Revision: 80828
URL: http://llvm.org/viewvc/llvm-project?rev=80828&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p1.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=80828&r1=80827&r2=80828&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Sep 2 14:32:14 2009
@@ -4329,13 +4329,13 @@
// 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))
Modified: cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p1.cpp?rev=80828&r1=80827&r2=80828&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p1.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p1.cpp Wed Sep 2 14:32:14 2009
@@ -27,6 +27,9 @@
value_ += b.value_;
return *this;
}
+
+ class Representation {};
+ friend class Representation;
};
class A {
More information about the cfe-commits
mailing list