Fixed lexical declaration context when instantiating a friend / out-of-line class template member.

llvm-svn: 145146
This commit is contained in:
Abramo Bagnara 2011-11-26 13:33:46 +00:00
parent 8c8486dbb2
commit edf99fff49
1 changed files with 7 additions and 0 deletions

View File

@ -862,9 +862,16 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
// Finish handling of friends.
if (isFriend) {
DC->makeDeclVisibleInContext(Inst, /*Recoverable*/ false);
Inst->setLexicalDeclContext(Owner);
RecordInst->setLexicalDeclContext(Owner);
return Inst;
}
if (D->isOutOfLine()) {
Inst->setLexicalDeclContext(D->getLexicalDeclContext());
RecordInst->setLexicalDeclContext(D->getLexicalDeclContext());
}
Owner->addDecl(Inst);
if (!PrevClassTemplate) {