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 fc51684..b754841 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -711,7 +711,9 @@
   // 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.