[cfe-commits] r145146 - /cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Abramo Bagnara abramo.bagnara at gmail.com
Sat Nov 26 05:33:46 PST 2011


Author: abramo
Date: Sat Nov 26 07:33:46 2011
New Revision: 145146

URL: http://llvm.org/viewvc/llvm-project?rev=145146&view=rev
Log:
Fixed lexical declaration context when instantiating a friend / out-of-line class template member.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=145146&r1=145145&r2=145146&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Sat Nov 26 07:33:46 2011
@@ -862,9 +862,16 @@
   // 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) {





More information about the cfe-commits mailing list