diff options
author | John McCall <rjmccall@apple.com> | 2010-04-24 01:30:58 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-24 01:30:58 +0000 |
commit | 76d326448d7e4c10b2896edc2ee855d1e68d1b88 (patch) | |
tree | b1935e979807f280a84d889baee246b4d657b72f /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | ba5f6eced29937e4e4851a2c0980744768413d66 (diff) |
Recommit r102215, this time being more careful to only set the "principal
declaration" (i.e. the only which will actually be looked up) to have the
non-member-operator bit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index fe60be062c..d14ea1a9ff 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1124,22 +1124,27 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, isExplicitSpecialization, Redeclaration, /*FIXME:*/OverloadableAttrRequired); + NamedDecl *PrincipalDecl = (TemplateParams + ? cast<NamedDecl>(FunctionTemplate) + : Function); + // If the original function was part of a friend declaration, // inherit its namespace state and add it to the owner. if (isFriend) { - NamedDecl *ToFriendD = 0; NamedDecl *PrevDecl; - if (TemplateParams) { - ToFriendD = cast<NamedDecl>(FunctionTemplate); + if (TemplateParams) PrevDecl = FunctionTemplate->getPreviousDeclaration(); - } else { - ToFriendD = Function; + else PrevDecl = Function->getPreviousDeclaration(); - } - ToFriendD->setObjectOfFriendDecl(PrevDecl != NULL); - DC->makeDeclVisibleInContext(ToFriendD, /*Recoverable=*/ false); + + PrincipalDecl->setObjectOfFriendDecl(PrevDecl != 0); + DC->makeDeclVisibleInContext(PrincipalDecl, /*Recoverable=*/ false); } + if (Function->isOverloadedOperator() && !DC->isRecord() && + PrincipalDecl->isInIdentifierNamespace(Decl::IDNS_Ordinary)) + PrincipalDecl->setNonMemberOperator(); + return Function; } |