From f5974fa0d5a8bc4055fb2a5c0e52dbd5dc3c62c9 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sat, 16 Jan 2010 20:21:20 +0000 Subject: When we are instantiating a member function of a local class, be sure to merge the local instantiation scope with the outer local instantiation scope, so that we can instantiate declarations from the function owning the local class. Fixes an assert while instantiating Boost.MPL's BOOST_MPL_ASSERT_MSG. llvm-svn: 93651 --- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema') diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index e909c4f0b9b..e6be5389cd0 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -717,7 +717,10 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, return Info->Function; } - Sema::LocalInstantiationScope Scope(SemaRef, TemplateParams != 0); + bool MergeWithParentScope = (TemplateParams != 0) || + !(isa(Owner) && + cast(Owner)->isDefinedOutsideFunctionOrMethod()); + Sema::LocalInstantiationScope Scope(SemaRef, MergeWithParentScope); llvm::SmallVector Params; QualType T = SubstFunctionType(D, Params); @@ -844,7 +847,10 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, return Info->Function; } - Sema::LocalInstantiationScope Scope(SemaRef, TemplateParams != 0); + bool MergeWithParentScope = (TemplateParams != 0) || + !(isa(Owner) && + cast(Owner)->isDefinedOutsideFunctionOrMethod()); + Sema::LocalInstantiationScope Scope(SemaRef, MergeWithParentScope); llvm::SmallVector Params; QualType T = SubstFunctionType(D, Params); -- cgit v1.2.3