]> granicus.if.org Git - clang/commitdiff
Recreate the DeclContext before adding the implicit friend forward declaration. This...
authorFrancois Pichet <pichet2000@gmail.com>
Tue, 31 May 2011 12:44:46 +0000 (12:44 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Tue, 31 May 2011 12:44:46 +0000 (12:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132333 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 878c21776d8b38d63096993cf5c3b450caa4b4fb..7c8d1cfbf383fb6726157337a0984bf264a83c41 100644 (file)
@@ -6657,6 +6657,8 @@ void Sema::InjectMicrosoftFriendForwardDeclaration(unsigned TagSpec,
     TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForTypeSpec(TagSpec);
     TagDecl *New = CXXRecordDecl::Create(Context, Kind, ContextToAdd, KWLoc,
                                          NameLoc, Name, 0);
+    // Recreate the DeclContext.
+    ContextRAII SavedContext(*this, ContextToAdd);
     if (getCurScope()->getFnParent())
       PushOnScopeChains(New, getScopeForContext(ContextToAdd), true);
     else