Special-case default argument expression in instantiation. This should fix PR4301. Doug, please double-check my assumptions. Read the PR for more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86465 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index 9c0f1ec..c136eee 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -108,3 +108,26 @@
 };
 D::D() { } // expected-note {{in instantiation of default function argument expression for 'A<int *>' required he}}
 }
+
+// PR5301
+namespace pr5301 {
+  void f(int, int = 0);
+
+  template <typename T>
+  void g(T, T = 0);
+
+  template <int I>
+  void i(int a = I);
+
+  template <typename T>
+  void h(T t) {
+    f(0);
+    g(1);
+    g(t);
+    i<2>();
+  }
+
+  void test() {
+    h(0);
+  }
+}