Preserve the original scope when picking the right scope for a friend
declaration, because we'll need it later. Hopefully fixed self-host. llvm-svn: 116399
This commit is contained in:
parent
fe92a9384e
commit
ccbc032146
|
@ -6337,6 +6337,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
|
||||||
// The context we found the declaration in, or in which we should
|
// The context we found the declaration in, or in which we should
|
||||||
// create the declaration.
|
// create the declaration.
|
||||||
DeclContext *DC;
|
DeclContext *DC;
|
||||||
|
Scope *DCScope = S;
|
||||||
LookupResult Previous(*this, NameInfo, LookupOrdinaryName,
|
LookupResult Previous(*this, NameInfo, LookupOrdinaryName,
|
||||||
ForRedeclaration);
|
ForRedeclaration);
|
||||||
|
|
||||||
|
@ -6395,7 +6396,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
|
||||||
&& !getLangOptions().CPlusPlus0x)
|
&& !getLangOptions().CPlusPlus0x)
|
||||||
Diag(DS.getFriendSpecLoc(), diag::err_friend_is_member);
|
Diag(DS.getFriendSpecLoc(), diag::err_friend_is_member);
|
||||||
|
|
||||||
S = getScopeForDeclContext(S, DC);
|
DCScope = getScopeForDeclContext(S, DC);
|
||||||
|
|
||||||
// - There's a non-dependent scope specifier, in which case we
|
// - There's a non-dependent scope specifier, in which case we
|
||||||
// compute it and do a previous lookup there for a function
|
// compute it and do a previous lookup there for a function
|
||||||
|
@ -6454,7 +6455,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Redeclaration = false;
|
bool Redeclaration = false;
|
||||||
NamedDecl *ND = ActOnFunctionDeclarator(S, D, DC, T, TInfo, Previous,
|
NamedDecl *ND = ActOnFunctionDeclarator(DCScope, D, DC, T, TInfo, Previous,
|
||||||
move(TemplateParams),
|
move(TemplateParams),
|
||||||
IsDefinition,
|
IsDefinition,
|
||||||
Redeclaration);
|
Redeclaration);
|
||||||
|
|
Loading…
Reference in New Issue