Sema: Subst type default template args earlier
Summary:
We would not perform substitution at an appropriate point, allowing strange
results to appear. We would accepts things that we shouldn't or mangle things incorrectly. Note that this hasn't fixed the other cases like
template-template parameters or non-type template parameters.
Reviewers: doug.gregor, rjmccall, rsmith
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1507
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189540 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index a9daa0d..f03f499 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -910,3 +910,26 @@
};
void g() { f(); }
}
+
+namespace test41 {
+ // CHECK: define linkonce_odr void @_ZN6test414funcINS_1XEEEvNS_3fooILi20ES1_EE
+ template <int i, class T> struct foo {
+ template <class T2 = T> friend void func(foo x) {}
+ };
+
+ struct X {};
+
+ void g() { func(foo<20, X>()); }
+}
+
+namespace test42 {
+ // CHECK: define linkonce_odr void @_ZN6test424funcINS_1XEEEvNS_3fooILi20ES1_EE
+ template <int i, template <class> class T> struct foo {
+ template <template <class> class T2 = T> friend void func(foo x) {}
+ };
+
+ template <class V> struct X {
+ };
+
+ void g() { func(foo<20, X>()); }
+}