Just mangle substituted template parameter types as unresolved types.
This is kindof questionable but seems to do more-or-less the right thing.
This is not a particularly friendly part of the ABI.

llvm-svn: 134227
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp
index 8363528..dd10ca4 100644
--- a/clang/test/CodeGenCXX/mangle.cpp
+++ b/clang/test/CodeGenCXX/mangle.cpp
@@ -770,3 +770,35 @@
   // CHECK: define weak_odr void @_ZN6test312f3IiEEDTcl1gfp_EET_
   template void f3(int);
 }
+
+// PR10205
+namespace test32 {
+  template<typename T, int=T::value> struct A {
+    typedef int type;
+  };
+  struct B { enum { value = 4 }; };
+
+  template <class T> typename A<T>::type foo() { return 0; }
+  void test() {
+    foo<B>();
+    // CHECK: call i32 @_ZN6test323fooINS_1BEEENS_1AIT_XsrS3_5valueEE4typeEv()
+  }
+}
+
+namespace test33 {
+  template <class T> struct X {
+    enum { value = T::value };
+  };
+
+  template<typename T, int=X<T>::value> struct A {
+    typedef int type;
+  };
+  struct B { enum { value = 4 }; };
+
+  template <class T> typename A<T>::type foo() { return 0; }
+
+  void test() {
+    foo<B>();
+    // CHECK: call i32 @_ZN6test333fooINS_1BEEENS_1AIT_Xsr1XIS3_EE5valueEE4typeEv()
+  }
+}