From 43669f84ed10118d39ccdce749d8d2e549a28a07 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sat, 5 Mar 2011 17:54:25 +0000 Subject: When determining template instantiation arguments within a function template (not a specialization!), use the "injected" function template arguments, which correspond to the template parameters of the function template. This is required when substituting into the default template parameters of template template parameters within a function template. Fixes PR9016. llvm-svn: 127092 --- clang/lib/Sema/SemaTemplateInstantiate.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp') diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 4e1976e322d..4108e9fd6fa 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -95,6 +95,12 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D, assert(Function->getPrimaryTemplate() && "No function template?"); if (Function->getPrimaryTemplate()->isMemberSpecialization()) break; + } else if (FunctionTemplateDecl *FunTmpl + = Function->getDescribedFunctionTemplate()) { + // Add the "injected" template arguments. + std::pair + Injected = FunTmpl->getInjectedTemplateArgs(); + Result.addOuterTemplateArguments(Injected.first, Injected.second); } // If this is a friend declaration and it declares an entity at -- cgit v1.2.3