Improve instantiation of default template arguments for nested
templates. The instantiation of these default arguments must be (and
now, is) delayed until the template argument is actually used, at
which point we substitute all levels of template arguments
concurrently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86578 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 641ea24..d374762 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -923,18 +923,8 @@
                                  D->wasDeclaredWithTypename(),
                                  D->isParameterPack());
 
-  // FIXME: Do we actually want to perform substitution here? I don't think
-  // we do.
-  if (D->hasDefaultArgument()) {
-    DeclaratorInfo *DefaultPattern = D->getDefaultArgumentInfo();
-    DeclaratorInfo *DefaultInst
-      = SemaRef.SubstType(DefaultPattern, TemplateArgs,
-                          D->getDefaultArgumentLoc(),
-                          D->getDeclName());
-
-    Inst->setDefaultArgument(DefaultInst,
-                             D->defaultArgumentWasInherited() /* preserve? */);
-  }
+  if (D->hasDefaultArgument())
+    Inst->setDefaultArgument(D->getDefaultArgumentInfo(), false);  
 
   // Introduce this template parameter's instantiation into the instantiation 
   // scope.