aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-25 07:03:22 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-25 07:03:22 +0000
commit0ed093069ae9b000278a2df01f372438d9c63ec1 (patch)
tree5b69d59fe4b651f2b7b017ca5adaa575b0aba078
parentf43d0b37c1d3f529d0f206e786ae6de61c5f364a (diff)
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
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp4
1 files changed, 3 insertions, 1 deletions
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.