summaryrefslogtreecommitdiffstats
path: root/test/CXX/temp/temp.fct.spec
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/temp/temp.fct.spec')
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp21
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp21
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp3
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp13
4 files changed, 55 insertions, 3 deletions
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
index 36b0700..dcf5a08 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
@@ -26,3 +26,24 @@ namespace ParameterPacksWithFunctions {
unsigned_c<2> uc2 = f<float, double>();
}
}
+
+namespace rdar12176336 {
+ typedef void (*vararg_func)(...);
+
+ struct method {
+ vararg_func implementation;
+
+ method(vararg_func implementation) : implementation(implementation) {}
+
+ template<typename TReturnType, typename... TArguments, typename TFunctionType = TReturnType (*)(TArguments...)>
+ auto getImplementation() const -> TFunctionType
+ {
+ return reinterpret_cast<TFunctionType>(implementation);
+ }
+ };
+
+ void f() {
+ method m(nullptr);
+ auto imp = m.getImplementation<int, int, int>();
+ }
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
index 90d2949..33efac0 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
@@ -15,8 +15,7 @@ void test_f1(int *ip, float fv) {
f1(ip, fv);
}
-// TODO: this diagnostic can and should improve
-template<typename T> void f2(T*, T*); // expected-note {{candidate template ignored: failed template argument deduction}} \
+template<typename T> void f2(T*, T*); // expected-note {{candidate template ignored: could not match 'T *' against 'ConvToIntPtr'}} \
// expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'float')}}
struct ConvToIntPtr {
@@ -28,3 +27,21 @@ void test_f2(int *ip, float *fp) {
f2(ip, ip); // okay
f2(ip, fp); // expected-error{{no matching function}}
}
+
+namespace test3 {
+ template<typename T>
+ struct bar { };
+
+ template<typename T>
+ struct foo {
+ operator bar<T>();
+ };
+
+ template<typename T>
+ void func(bar<T>) { // expected-note {{candidate template ignored: could not match 'bar' against 'foo'}}
+ }
+
+ void test() {
+ func(foo<int>()); // expected-error {{no matching function}}
+ }
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
index 8b192fa..cd1d9f1 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
@@ -53,8 +53,9 @@ void test_simple_ref_deduction(int *ip, float *fp, double *dp) {
}
+// FIXME: Use the template parameter names in this diagnostic.
template<typename ...Args1, typename ...Args2>
-typename get_nth_type<0, Args1...>::type first_arg_pair(pair<Args1, Args2>...); // expected-note{{candidate template ignored: failed template argument deduction}}
+typename get_nth_type<0, Args1...>::type first_arg_pair(pair<Args1, Args2>...); // expected-note{{candidate template ignored: could not match 'pair<type-parameter-0-0, type-parameter-0-1>' against 'int'}}
template<typename ...Args1, typename ...Args2>
typename get_nth_type<1, Args1...>::type second_arg_pair(pair<Args1, Args2>...);
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
index 7774b5c..d7989e3 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
@@ -53,3 +53,16 @@ namespace DeduceNonTypeTemplateArgsInArray {
tuple<unsigned_c<1>, unsigned_c<2>, unsigned_c<3>>
>::value? 1 : -1];
}
+
+namespace DeduceWithDefaultArgs {
+ template<template<typename...> class Container> void f(Container<int>); // expected-note {{substitution failure [with Container = X]}}
+ template<typename, typename = int> struct X {};
+ void g() {
+ // OK, use default argument for the second template parameter.
+ f(X<int>{});
+ f(X<int, int>{});
+
+ // Not OK.
+ f(X<int, double>{}); // expected-error {{no matching function for call to 'f'}}
+ }
+}
OpenPOWER on IntegriCloud