From: Douglas Gregor Date: Fri, 25 Sep 2009 07:03:22 +0000 (+0000) Subject: Sigh. Be *really* careful when copying a default function argument during template... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ed093069ae9b000278a2df01f372438d9c63ec1;p=clang Sigh. Be *really* careful when copying a default function argument during template instantiation git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82761 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index fc51684f9e..b7548415aa 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -711,7 +711,9 @@ ParmVarDecl *TemplateDeclInstantiator::VisitParmVarDecl(ParmVarDecl *D) { // Mark the default argument as being uninstantiated. if (D->hasUninstantiatedDefaultArg()) Param->setUninstantiatedDefaultArg(D->getUninstantiatedDefaultArg()); - + else if (Expr *Arg = D->getDefaultArg()) + Param->setUninstantiatedDefaultArg(Arg); + // Note: we don't try to instantiate function parameters until after // we've instantiated the function's type. Therefore, we don't have // to check for 'void' parameter types here.