diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2011-11-26 13:33:46 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2011-11-26 13:33:46 +0000 |
commit | 4c51548271d2f8385127e1d943764ae8939d7794 (patch) | |
tree | 2d5743c9ff2b699ae8cce4c20bc6d5a6f7121b00 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 4c7ce36a761b65a659aa6c4728a318e5d06f5f95 (diff) |
Fixed lexical declaration context when instantiating a friend / out-of-line class template member.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index c20033bbc2..9477192e23 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -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) { |