Basic support for default argument expressions for function templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79972 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index ded49b3..86b1cbd 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -591,16 +591,6 @@
 
   QualType T = SemaRef.adjustParameterType(OrigT);
 
-  if (D->getDefaultArg()) {
-    // FIXME: Leave a marker for "uninstantiated" default
-    // arguments. They only get instantiated on demand at the call
-    // site.
-    unsigned DiagID = SemaRef.Diags.getCustomDiagID(Diagnostic::Warning,
-        "sorry, dropping default argument during template instantiation");
-    SemaRef.Diag(D->getDefaultArg()->getSourceRange().getBegin(), DiagID)
-      << D->getDefaultArg()->getSourceRange();
-  }
-
   // Allocate the parameter
   ParmVarDecl *Param = 0;
   if (T == OrigT)
@@ -613,6 +603,10 @@
                                         T, D->getDeclaratorInfo(), OrigT,
                                         D->getStorageClass(), 0);
 
+  // Mark the default argument as being uninstantiated.
+  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.