summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/deduction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/deduction.cpp')
-rw-r--r--test/SemaTemplate/deduction.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp
index 5695cab9a27e..2275a8b3b7ad 100644
--- a/test/SemaTemplate/deduction.cpp
+++ b/test/SemaTemplate/deduction.cpp
@@ -407,3 +407,38 @@ namespace overload_vs_pack {
void test() { j(x, f, x); }
}
}
+
+namespace b29946541 {
+ template<typename> class A {};
+ template<typename T, typename U, template<typename, typename> class C>
+ void f(C<T, U>); // expected-note {{failed template argument deduction}}
+ void g(A<int> a) { f(a); } // expected-error {{no match}}
+}
+
+namespace deduction_from_empty_list {
+ template<int M, int N = 5> void f(int (&&)[N], int (&&)[N]) { // expected-note {{1 vs. 2}}
+ static_assert(M == N, "");
+ }
+
+ void test() {
+ f<5>({}, {});
+ f<1>({}, {0});
+ f<1>({0}, {});
+ f<1>({0}, {0});
+ f<1>({0}, {0, 1}); // expected-error {{no matching}}
+ }
+}
+
+namespace check_extended_pack {
+ template<typename T> struct X { typedef int type; };
+ template<typename ...T> void f(typename X<T>::type...);
+ template<typename T> void f(T, int, int);
+ void g() {
+ f<int>(0, 0, 0);
+ }
+
+ template<int, int*> struct Y {};
+ template<int ...N> void g(Y<N...>); // expected-note {{deduced non-type template argument does not have the same type as the corresponding template parameter ('int *' vs 'int')}}
+ int n;
+ void h() { g<0>(Y<0, &n>()); } // expected-error {{no matching function}}
+}