diff options
author | John McCall <rjmccall@apple.com> | 2010-04-13 06:39:49 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-13 06:39:49 +0000 |
commit | ba9d853bec0d9cc10ac5fdeab807cc4b13d65791 (patch) | |
tree | 2cfa02cf60c8e323afaf8022c24c5ad3dda6dca3 /lib/Sema/SemaDecl.cpp | |
parent | b21b1c94285b174772a754f96a4fd70cb641846a (diff) |
Parse constructor names in friend declarations. Part of the fix for
PR6207.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 171bee66ca..005311f075 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3188,6 +3188,10 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, if (CheckMemberSpecialization(NewFD, Previous)) NewFD->setInvalidDecl(); } + + // Make sure this is set before checking the function declaration. + // We'll override the visibility type later. + if (isFriend) NewFD->setObjectOfFriendDecl(false); // Perform semantic checking on the function declaration. bool OverloadableAttrRequired = false; // FIXME: HACK! @@ -3199,7 +3203,10 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, "previous declaration set still overloaded"); if (isFriend && Redeclaration) { - AccessSpecifier Access = NewFD->getPreviousDeclaration()->getAccess(); + AccessSpecifier Access = AS_public; + if (!NewFD->isInvalidDecl()) + Access = NewFD->getPreviousDeclaration()->getAccess(); + if (FunctionTemplate) { FunctionTemplate->setObjectOfFriendDecl(true); FunctionTemplate->setAccess(Access); |