aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/temp/temp.fct.spec/temp.deduct
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/temp/temp.fct.spec/temp.deduct')
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp42
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp22
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp42
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp43
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp47
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp92
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp32
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp93
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp175
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp57
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp128
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp37
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp31
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp149
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p5.cpp61
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp22
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp47
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp28
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp11
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p1.cpp10
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp5
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp31
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp24
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp32
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp15
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp37
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp48
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp106
28 files changed, 0 insertions, 1467 deletions
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp
deleted file mode 100644
index 47184ec03455..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
-// expected-no-diagnostics
-
-#if !__has_feature(cxx_access_control_sfinae)
-# error No support for access control as part of SFINAE?
-#endif
-
-typedef char yes_type;
-typedef char (&no_type)[2];
-
-template<unsigned N> struct unsigned_c { };
-
-template<typename T>
-class has_copy_constructor {
- static T t;
-
- template<typename U> static yes_type check(unsigned_c<sizeof(U(t))> * = 0);
- template<typename U> static no_type check(...);
-
-public:
- static const bool value = (sizeof(check<T>(0)) == sizeof(yes_type));
-};
-
-struct HasCopy { };
-
-struct HasNonConstCopy {
- HasNonConstCopy(HasNonConstCopy&);
-};
-
-struct HasDeletedCopy {
- HasDeletedCopy(const HasDeletedCopy&) = delete;
-};
-
-struct HasPrivateCopy {
-private:
- HasPrivateCopy(const HasPrivateCopy&);
-};
-
-int check0[has_copy_constructor<HasCopy>::value? 1 : -1];
-int check1[has_copy_constructor<HasNonConstCopy>::value? 1 : -1];
-int check2[has_copy_constructor<HasDeletedCopy>::value? -1 : 1];
-int check3[has_copy_constructor<HasPrivateCopy>::value? -1 : 1];
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp
deleted file mode 100644
index bc074ba25e8e..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -verify %s
-
-struct Q { typedef int type; };
-
-// "The substitution occurs in all types and expressions that are used in [...]
-// template parameter declarations." In particular, we must substitute into the
-// type of a parameter pack that is not a pack expansion, even if we know the
-// corresponding argument pack is empty.
-template<typename T, typename T::type...> void a(T);
-int &a(...);
-int &a_disabled = a(0);
-int &a_enabled = a(Q()); // expected-error {{cannot bind to a temporary of type 'void'}}
-
-template<typename T, template<typename T::type> class ...X> void b(T);
-int &b(...);
-int &b_disabled = b(0);
-int &b_enabled = b(Q()); // expected-error {{cannot bind to a temporary of type 'void'}}
-
-template<typename T, template<typename T::type...> class ...X> void c(T);
-int &c(...);
-int &c_disabled = c(0);
-int &c_enabled = c(Q()); // expected-error {{cannot bind to a temporary of type 'void'}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp
deleted file mode 100644
index f7103a33cc72..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/p9.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
-
-template <int> int f(int); // expected-note {{candidate function}}
-#if __cplusplus <= 199711L
-// expected-note@-2 {{candidate function}}
-#endif
-
-template <signed char> int f(int); // expected-note {{candidate function}}
-#if __cplusplus <= 199711L
-// expected-note@-2 {{candidate function}}
-#endif
-
-int i1 = f<1>(0); // expected-error{{call to 'f' is ambiguous}}
-int i2 = f<1000>(0);
-#if __cplusplus <= 199711L
-// expected-error@-2{{call to 'f' is ambiguous}}
-#endif
-
-namespace PR6707 {
- template<typename T, T Value>
- struct X { };
-
- template<typename T, T Value>
- void f(X<T, Value>);
-
- void g(X<int, 10> x) {
- f(x);
- }
-
- static const unsigned char ten = 10;
- template<typename T, T Value, typename U>
- void f2(X<T, Value>, X<U, Value>);
- // expected-note@-1 {{candidate template ignored: deduced values of conflicting types for parameter 'Value' (10 of type 'int' vs. 10 of type 'char')}}
- // expected-note@-2 {{candidate template ignored: deduced values of conflicting types for parameter 'Value' (10 of type 'char' vs. 10 of type 'int')}}
-
- void g2() {
- f2(X<int, 10>(), X<char, ten>()); // expected-error {{no matching}}
- f2(X<char, 10>(), X<int, ten>()); // expected-error {{no matching}}
- }
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp
deleted file mode 100644
index 1907bd77998f..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/sfinae-1.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// RUN: %clang_cc1 -verify %s
-// expected-no-diagnostics
-
-typedef char one_byte;
-struct two_bytes { char data[2]; };
-
-template<typename T> one_byte __is_class_check(int T::*);
-template<typename T> two_bytes __is_class_check(...);
-
-template<typename T> struct is_class {
- static const bool value = sizeof(__is_class_check<T>(0)) == 1;
-};
-
-struct X { };
-
-int array0[is_class<X>::value? 1 : -1];
-int array1[is_class<int>::value? -1 : 1];
-int array2[is_class<char[3]>::value? -1 : 1];
-
-namespace instantiation_order1 {
- template<typename T>
- struct it_is_a_trap {
- typedef typename T::trap type;
- };
-
- template<bool, typename T = void>
- struct enable_if {
- typedef T type;
- };
-
- template<typename T>
- struct enable_if<false, T> { };
-
- template<typename T>
- typename enable_if<sizeof(T) == 17>::type
- f(const T&, typename it_is_a_trap<T>::type* = 0);
-
- void f(...);
-
- void test_f() {
- f('a');
- }
-}
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
deleted file mode 100644
index 33efac02482d..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-template<typename T> struct A { };
-
-template<typename T> A<T> f0(T*);
-
-void test_f0(int *ip, float const *cfp) {
- A<int> a0 = f0(ip);
- A<const float> a1 = f0(cfp);
-}
-
-template<typename T> void f1(T*, int);
-
-void test_f1(int *ip, float fv) {
- f1(ip, fv);
-}
-
-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 {
- operator int*() const;
-};
-
-void test_f2(int *ip, float *fp) {
- f2(ip, ConvToIntPtr()); // expected-error{{no matching function}}
- 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
deleted file mode 100644
index 081bba2b8dff..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-
-// Metafunction to extract the Nth type from a set of types.
-template<unsigned N, typename ...Types> struct get_nth_type;
-
-template<unsigned N, typename Head, typename ...Tail>
-struct get_nth_type<N, Head, Tail...> : get_nth_type<N-1, Tail...> { };
-
-template<typename Head, typename ...Tail>
-struct get_nth_type<0, Head, Tail...> {
- typedef Head type;
-};
-
-// Placeholder type when get_nth_type fails.
-struct no_type {};
-
-template<unsigned N>
-struct get_nth_type<N> {
- typedef no_type type;
-};
-
-template<typename T, typename U> struct pair { };
-template<typename T, typename U> pair<T, U> make_pair(T, U);
-
-// For a function parameter pack that occurs at the end of the
-// parameter-declaration-list, the type A of each remaining argument
-// of the call is compared with the type P of the declarator-id of the
-// function parameter pack.
-template<typename ...Args>
-typename get_nth_type<0, Args...>::type first_arg(Args...);
-
-template<typename ...Args>
-typename get_nth_type<1, Args...>::type second_arg(Args...);
-
-void test_simple_deduction(int *ip, float *fp, double *dp) {
- int *ip1 = first_arg(ip);
- int *ip2 = first_arg(ip, fp);
- int *ip3 = first_arg(ip, fp, dp);
- no_type nt1 = first_arg();
-}
-
-template<typename ...Args>
-typename get_nth_type<0, Args...>::type first_arg_ref(Args&...);
-
-template<typename ...Args>
-typename get_nth_type<1, Args...>::type second_arg_ref(Args&...);
-
-void test_simple_ref_deduction(int *ip, float *fp, double *dp) {
- int *ip1 = first_arg_ref(ip);
- int *ip2 = first_arg_ref(ip, fp);
- int *ip3 = first_arg_ref(ip, fp, dp);
- no_type nt1 = first_arg_ref();
-}
-
-
-// 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: 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>...);
-
-void test_pair_deduction(int *ip, float *fp, double *dp) {
- int *ip1 = first_arg_pair(make_pair(ip, 17));
- int *ip2 = first_arg_pair(make_pair(ip, 17), make_pair(fp, 17));
- int *ip3 = first_arg_pair(make_pair(ip, 17), make_pair(fp, 17),
- make_pair(dp, 17));
- float *fp1 = second_arg_pair(make_pair(ip, 17), make_pair(fp, 17));
- float *fp2 = second_arg_pair(make_pair(ip, 17), make_pair(fp, 17),
- make_pair(dp, 17));
- no_type nt1 = first_arg_pair();
- no_type nt2 = second_arg_pair();
- no_type nt3 = second_arg_pair(make_pair(ip, 17));
-
-
- first_arg_pair(make_pair(ip, 17), 16); // expected-error{{no matching function for call to 'first_arg_pair'}}
-}
-
-// A function parameter pack not at the end of the parameter list is never
-// deduced. We interpret this as meaning the types within it are never
-// deduced, and thus must match explicitly-specified values.
-template<typename ...Types> struct tuple { };
-
-template<typename ...Types>
-void pack_not_at_end(tuple<Types...>, Types... values, int); // expected-note {{<int *, double *> vs. <>}}
-
-void test_pack_not_at_end(tuple<int*, double*> t2) {
- pack_not_at_end(t2, 0, 0, 0); // expected-error {{no match}}
- // FIXME: Should the "original argument type must match deduced parameter
- // type" rule apply here?
- pack_not_at_end<int*, double*>(t2, 0, 0, 0); // ok
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
deleted file mode 100644
index 4be81d882588..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
-template<typename T> struct A { };
-
-// bullet 1
-template<typename T> A<T> f0(T* ptr);
-
-void test_f0_bullet1() {
- int arr0[6];
- A<int> a0 = f0(arr0);
- const int arr1[] = { 1, 2, 3, 4, 5 };
- A<const int> a1 = f0(arr1);
-}
-
-// bullet 2
-int g0(int, int);
-float g1(float);
-
-void test_f0_bullet2() {
- A<int(int, int)> a0 = f0(g0);
- A<float(float)> a1 = f0(g1);
-}
-
-// bullet 3
-struct X { };
-const X get_X();
-
-template<typename T> A<T> f1(T);
-
-void test_f1_bullet3() {
- A<X> a0 = f1(get_X());
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
deleted file mode 100644
index ebff0a1df4e7..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify %s
-
-// A forwarding reference is an rvalue reference to a cv-unqualified template
-// parameter that does not represent a template parameter of a class template.
-#if __cplusplus > 201402L
-namespace ClassTemplateParamNotForwardingRef {
- // This is not a forwarding reference.
- template<typename T> struct A { // expected-note {{candidate}}
- A(T&&); // expected-note {{no known conversion from 'int' to 'int &&'}}
- };
- int n;
- A a = n; // expected-error {{no viable constructor or deduction guide}}
-
- A b = 0;
- A<int> *pb = &b;
-
- // This is a forwarding reference.
- template<typename T> A(T&&) -> A<T>;
- A c = n;
- A<int&> *pc = &c;
-
- A d = 0;
- A<int> *pd = &d;
-
- template<typename T = void> struct B {
- // This is a forwarding reference.
- template<typename U> B(U &&);
- };
- B e = n;
- B<void> *pe = &e;
-}
-#endif
-
-// If P is a forwarding reference and the argument is an lvalue, the type
-// "lvalue reference to A" is used in place of A for type deduction.
-template<typename T> struct X { };
-
-template<typename T> X<T> f0(T&&);
-
-struct Y { };
-
-template<typename T> T prvalue();
-template<typename T> T&& xvalue();
-template<typename T> T& lvalue();
-
-void test_f0() {
- X<int> xi0 = f0(prvalue<int>());
- X<int> xi1 = f0(xvalue<int>());
- X<int&> xi2 = f0(lvalue<int>());
- X<Y> xy0 = f0(prvalue<Y>());
- X<Y> xy1 = f0(xvalue<Y>());
- X<Y&> xy2 = f0(lvalue<Y>());
-}
-
-template<typename T> X<T> f1(const T&&); // expected-note{{candidate function [with T = int] not viable: no known conversion from 'int' to 'const int &&' for 1st argument}} \
-// expected-note{{candidate function [with T = Y] not viable: no known conversion from 'Y' to 'const Y &&' for 1st argument}}
-
-void test_f1() {
- X<int> xi0 = f1(prvalue<int>());
- X<int> xi1 = f1(xvalue<int>());
- f1(lvalue<int>()); // expected-error{{no matching function for call to 'f1'}}
- X<Y> xy0 = f1(prvalue<Y>());
- X<Y> xy1 = f1(xvalue<Y>());
- f1(lvalue<Y>()); // expected-error{{no matching function for call to 'f1'}}
-}
-
-namespace std_example {
- template <class T> int f(T&&);
- template <class T> int g(const T&&); // expected-note{{candidate function [with T = int] not viable: no known conversion from 'int' to 'const int &&' for 1st argument}}
-
- int i;
- int n1 = f(i);
- int n2 = f(0);
- int n3 = g(i); // expected-error{{no matching function for call to 'g'}}
-
-#if __cplusplus > 201402L
- template<class T> struct A { // expected-note {{candidate}}
- template<class U>
- A(T &&, U &&, int *); // expected-note {{[with T = int, U = int] not viable: no known conversion from 'int' to 'int &&'}}
- A(T &&, int *); // expected-note {{requires 2}}
- };
- template<class T> A(T &&, int *) -> A<T>; // expected-note {{requires 2}}
-
- int *ip;
- A a{i, 0, ip}; // expected-error {{no viable constructor or deduction guide}}
- A a0{0, 0, ip};
- A a2{i, ip};
-
- A<int> &a0r = a0;
- A<int&> &a2r = a2;
-#endif
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
deleted file mode 100644
index ff8178f94769..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-template<typename T> struct A { };
-
-// Top-level cv-qualifiers of P's type are ignored for type deduction.
-template<typename T> A<T> f0(const T);
-
-void test_f0(int i, const int ci) {
- A<int> a0 = f0(i);
- A<int> a1 = f0(ci);
-}
-
-// If P is a reference type, the type referred to by P is used for type
-// deduction.
-template<typename T> A<T> f1(T&);
-
-void test_f1(int i, const int ci, volatile int vi) {
- A<int> a0 = f1(i);
- A<const int> a1 = f1(ci);
- A<volatile int> a2 = f1(vi);
-}
-
-template<typename T, unsigned N> struct B { };
-template<typename T, unsigned N> B<T, N> g0(T (&array)[N]);
-template<typename T, unsigned N> B<T, N> g0b(const T (&array)[N]);
-
-void test_g0() {
- int array0[5];
- B<int, 5> b0 = g0(array0);
- const int array1[] = { 1, 2, 3};
- B<const int, 3> b1 = g0(array1);
- B<int, 3> b2 = g0b(array1);
-}
-
-template<typename T> B<T, 0> g1(const A<T>&);
-
-void test_g1(A<float> af) {
- B<float, 0> b0 = g1(af);
- B<int, 0> b1 = g1(A<int>());
-}
-
-// - If the original P is a reference type, the deduced A (i.e., the type
-// referred to by the reference) can be more cv-qualified than the
-// transformed A.
-template<typename T> A<T> f2(const T&);
-
-void test_f2(int i, const int ci, volatile int vi) {
- A<int> a0 = f2(i);
- A<int> a1 = f2(ci);
- A<volatile int> a2 = f2(vi);
-}
-
-// PR5913
-template <typename T, int N>
-void Foo(const T (&a)[N]) {
- T x;
- x = 0;
-}
-
-const int a[1] = { 0 };
-
-void Test() {
- Foo(a);
-}
-
-// - The transformed A can be another pointer or pointer to member type that
-// can be converted to the deduced A via a qualification conversion (4.4).
-template<typename T> A<T> f3(T * * const * const);
-
-void test_f3(int ***ip, volatile int ***vip) {
- A<int> a0 = f3(ip);
- A<volatile int> a1 = f3(vip);
-}
-
-// Also accept conversions for pointer types which require removing
-// [[noreturn]].
-namespace noreturn_stripping {
- template <class R>
- void f(R (*function)());
-
- void g() __attribute__ ((__noreturn__));
- void h();
- void test() {
- f(g);
- f(h);
- }
-}
-
-// - If P is a class, and P has the form template-id, then A can be a
-// derived class of the deduced A. Likewise, if P is a pointer to a class
-// of the form template-id, A can be a pointer to a derived class pointed
-// to by the deduced A.
-template<typename T, int I> struct C { };
-
-struct D : public C<int, 1> { };
-struct E : public D { };
-struct F : A<float> { };
-struct G : A<float>, C<int, 1> { };
-
-template<typename T, int I>
- C<T, I> *f4a(const C<T, I>&);
-template<typename T, int I>
- C<T, I> *f4b(C<T, I>);
-template<typename T, int I>
- C<T, I> *f4c(C<T, I>*);
-int *f4c(...);
-
-void test_f4(D d, E e, F f, G g) {
- C<int, 1> *ci1a = f4a(d);
- C<int, 1> *ci2a = f4a(e);
- C<int, 1> *ci1b = f4b(d);
- C<int, 1> *ci2b = f4b(e);
- C<int, 1> *ci1c = f4c(&d);
- C<int, 1> *ci2c = f4c(&e);
- C<int, 1> *ci3c = f4c(&g);
- int *ip1 = f4c(&f);
-}
-
-// PR8462
-namespace N {
- struct T0;
- struct T1;
-
- template<typename X, typename Y> struct B {};
-
- struct J : B<T0,T0> {};
- struct K : B<T1,T1> {};
-
- struct D : J, K {};
-
- template<typename X, typename Y> void F(B<Y,X>);
-
- void test()
- {
- D d;
- N::F<T0>(d); // Fails
- N::F<T1>(d); // OK
- }
-}
-
-namespace PR9233 {
- template<typename T> void f(const T **q); // expected-note{{candidate template ignored: deduced type 'const int **' of 1st parameter does not match adjusted type 'int **' of argument [with T = int]}}
-
- void g(int **p) {
- f(p); // expected-error{{no matching function for call to 'f'}}
- }
-
-}
-
-namespace PR27155 {
-
-struct B {};
-
-template<class T, int i> struct D : T {};
-template<class T> void Foo(D<T, 1>);
-
-int fn() {
- D<D<B, 1>, 0> f;
- Foo(f);
-}
-
-}
-
-namespace PR28195 {
-
-template<int N> struct B {};
-struct D : B<0>, B<1> {};
-
-template<int N> int callee(B<N>); // expected-note{{failed template argument deduction}}
-
-int caller() {
- callee(D()); // expected-error{{no matching function}}
-}
-
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
deleted file mode 100644
index 357ea664037d..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s
-
-namespace PR8598 {
- template<class T> struct identity { typedef T type; };
-
- template<class T, class C>
- void f(T C::*, typename identity<T>::type*){}
-
- struct X { void f() {}; };
-
- void g() { (f)(&X::f, 0); }
-}
-
-namespace PR12132 {
- template<typename S> void fun(const int* const S::* member) {}
- struct A { int* x; };
- void foo() {
- fun(&A::x);
- }
-}
-
-#if __cplusplus > 201402L
-namespace noexcept_conversion {
- template<typename R> void foo(R());
- template<typename R> void bar(R()) = delete;
- template<typename R> void bar(R() noexcept) {}
- void f() throw() {
- foo(&f);
- bar(&f);
- }
- // There is no corresponding rule for references.
- // We consider this to be a defect, and allow deduction to succeed in this
- // case. FIXME: Check this should be accepted once the DR is resolved.
- template<typename R> void baz(R(&)());
- void g() {
- baz(f);
- }
-
- // But there is one for member pointers.
- template<typename R, typename C, typename ...A> void quux(R (C::*)(A...));
- struct Q { void f(int, char) noexcept { quux(&Q::f); } };
-
- void g1() noexcept;
- void g2();
- template <class T> int h(T *, T *); // expected-note {{deduced conflicting types for parameter 'T' ('void () noexcept' vs. 'void ()')}}
- int x = h(g1, g2); // expected-error {{no matching function}}
-
- // We consider it a defect that deduction does not support the following.
- // FIXME: Check that the defect is resolved as we expect.
- template<bool B> int i(void () noexcept(B));
- int i1 = i(g1);
- int i2 = i(g2);
-}
-#else
-// expected-no-diagnostics
-#endif
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
deleted file mode 100644
index 8b18189bb3da..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p6.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-namespace test0 {
- template<class T> void apply(T x, void (*f)(T)) { f(x); } // expected-note 2 {{candidate template ignored: deduced conflicting types for parameter 'T'}}\
- // expected-note {{no overload of 'temp2' matching 'void (*)(int)'}}
-
- template<class A> void temp(A);
- void test0() {
- // okay: deduce T=int from first argument, A=int during overload
- apply(0, &temp);
- apply(0, &temp<>);
-
- // okay: deduce T=int from first and second arguments
- apply(0, &temp<int>);
-
- // deduction failure: T=int from first, T=long from second
- apply(0, &temp<long>); // expected-error {{no matching function for call to 'apply'}}
- }
-
- void over(int);
- int over(long);
-
- void test1() {
- // okay: deductions match
- apply(0, &over);
-
- // deduction failure: deduced T=long from first argument, T=int from second
- apply(0L, &over); // expected-error {{no matching function for call to 'apply'}}
- }
-
- void over(short);
-
- void test2() {
- // deduce T=int from first arg, second arg is undeduced context,
- // pick correct overload of 'over' during overload resolution for 'apply'
- apply(0, &over);
- }
-
- template<class A, class B> B temp2(A);
- void test3() {
- // deduce T=int from first arg, A=int B=void during overload resolution
- apply(0, &temp2);
- apply(0, &temp2<>);
- apply(0, &temp2<int>);
-
- // overload failure
- apply(0, &temp2<long>); // expected-error {{no matching function for call to 'apply'}}
- }
-}
-
-namespace test1 {
- template<class T> void invoke(void (*f)(T)) { f(T()); } // expected-note 6 {{couldn't infer template argument}} \
- // expected-note {{candidate template ignored: couldn't infer template argument 'T'}}
-
- template<class T> void temp(T);
- void test0() {
- // deduction failure: overload has template => undeduced context
- invoke(&temp); // expected-error {{no matching function for call to 'invoke'}}
- invoke(&temp<>); // expected-error {{no matching function for call to 'invoke'}}
-
- // okay: full template-id
- invoke(&temp<int>);
- }
-
- void over(int);
- int over(long);
-
- void test1() {
- // okay: only one overload matches
- invoke(&over);
- }
-
- void over(short);
-
- void test2() {
- // deduction failure: overload has multiple matches => undeduced context
- invoke(&over); // expected-error {{no matching function for call to 'invoke'}}
- }
-
- template<class A, class B> B temp2(A);
- void test3() {
- // deduction failure: overload has template => undeduced context
- // (even though partial application temp2<int> could in theory
- // let us infer T=int)
- invoke(&temp2); // expected-error {{no matching function for call to 'invoke'}}
- invoke(&temp2<>); // expected-error {{no matching function for call to 'invoke'}}
- invoke(&temp2<int>); // expected-error {{no matching function for call to 'invoke'}}
-
- // okay: full template-id
- invoke(&temp2<int, void>);
-
- // overload failure
- invoke(&temp2<int, int>); // expected-error {{no matching function for call to 'invoke'}}
- }
-}
-
-namespace rdar8360106 {
- template<typename R, typename T> void f0(R (*)(T), T);
- template<typename R, typename T> void f1(R (&)(T) , T); // expected-note{{candidate template ignored: couldn't infer template argument 'R'}}
- template<typename R, typename T> void f2(R (* const&)(T), T); // expected-note{{candidate template ignored: couldn't infer template argument 'R'}}
-
- int g(int);
- int g(int, int);
-
- void h() {
- f0(g, 1);
- f0(&g, 1);
- f1(g, 1);
- f1(&g, 1); // expected-error{{no matching function for call to 'f1'}}
- f2(g, 1); // expected-error{{no matching function for call to 'f2'}}
- f2(&g, 1);
- }
-}
-
-namespace PR11713 {
- template<typename T>
- int f(int, int, int);
-
- template<typename T>
- float f(float, float);
-
- template<typename R, typename B1, typename B2, typename A1, typename A2>
- R& g(R (*)(B1, B2), A1, A2);
-
- void h() {
- float &fr = g(f<int>, 1, 2);
- }
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
deleted file mode 100644
index badd5a8c6a2c..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p2.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-// FIXME: [temp.deduct.conv]p2 bullets 1 and 2 can't actually happen without
-// references?
-// struct ConvertibleToArray {
-// // template<typename T, unsigned N>
-// // operator T(()[]) const;
-
-// private:
-// typedef int array[17];
-
-// operator array() const;
-// };
-
-// void test_array(ConvertibleToArray cta) {
-// int *ip = cta;
-// ip = cta;
-// const float *cfp = cta;
-// }
-
-// bullet 2
-// struct ConvertibleToFunction {
-// template<typename T, typename A1, typename A2>
-// operator T(A1, A2) const () { };
-// };
-
-// bullet 3
-struct ConvertibleToCVQuals {
- template<typename T>
- operator T* const() const;
-};
-
-void test_cvqual_conv(ConvertibleToCVQuals ctcv) {
- int *ip = ctcv;
- const int *icp = ctcv;
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
deleted file mode 100644
index a5916ba65377..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p3.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
-struct AnyPtr {
- template<typename T>
- operator T*() const;
-};
-
-// If A is a cv-qualified type, the top level cv-qualifiers of A's type
-// are ignored for type deduction.
-void test_cvquals(AnyPtr ap) {
- int* const ip = ap;
- const float * const volatile fp = ap;
-}
-
-// If A is a reference type, the type referred to by A is used for
-// type deduction.
-void test_ref_arg(AnyPtr ap) {
- const int* const &ip = ap;
- double * const &dp = ap;
-}
-
-struct AnyRef {
- template<typename T>
- operator T&() const;
-};
-
-void test_ref_param(AnyRef ar) {
- int &ir = ar;
- const float &fr = ar;
- int i = ar;
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
deleted file mode 100644
index 085976b08133..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only %s -verify
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only %s -verify
-
-struct AnyT {
- template<typename T>
- operator T();
-};
-
-void test_cvqual_ref(AnyT any) {
- const int &cir = any;
-}
-
-struct AnyThreeLevelPtr {
- template<typename T>
- operator T***() const {
- T x = 0; // expected-note 2{{declared const here}}
- x = 0; // expected-error 2{{const-qualified type}}
- T ***p;
- return p;
- }
-};
-
-struct X { };
-
-void test_deduce_with_qual(AnyThreeLevelPtr a3) {
- int * const * const * const ip1 = a3;
- // FIXME: This is wrong; we are supposed to deduce 'T = int' here.
- const int * const * const * const ip2 = a3; // expected-note {{instantiation of}}
- // This one is correct, though.
- const double * * * ip3 = a3; // expected-note {{instantiation of}}
-}
-
-struct AnyPtrMem {
- template<typename Class, typename T>
- operator T Class::*() const
- {
- // This is correct: we don't need a qualification conversion here, so we
- // deduce 'T = const float'.
- T x = 0; // expected-note {{declared const here}}
- x = 0; // expected-error {{const-qualified type}}
- return 0;
- }
-};
-
-void test_deduce_ptrmem_with_qual(AnyPtrMem apm) {
- const float X::* pm = apm; // expected-note {{instantiation of}}
-}
-
-struct TwoLevelPtrMem {
- template<typename Class1, typename Class2, typename T>
- operator T Class1::*Class2::*() const
- {
- T x = 0; // expected-note 2{{declared const here}}
- x = 0; // expected-error 2{{const-qualified type}}
- return 0;
- }
-};
-
-void test_deduce_two_level_ptrmem_with_qual(TwoLevelPtrMem apm) {
- // FIXME: This is wrong: we should deduce T = 'float'
- const float X::* const X::* pm2 = apm; // expected-note {{instantiation of}}
- // This is correct: we don't need a qualification conversion, so we directly
- // deduce T = 'const double'
- const double X::* X::* pm1 = apm; // expected-note {{instantiation of}}
-}
-
-namespace non_ptr_ref_cv_qual {
- template<typename Expected>
- struct ConvToT {
- template<typename T> operator T() {
- using Check = T;
- using Check = Expected;
- }
- };
- const int test_conv_to_t_1 = ConvToT<int>();
- // We intentionally deviate from [temp.deduct.conv]p4 here, and also remove
- // the top-level cv-quaifiers from A *after* removing the reference type, if
- // P is not also a reference type. This matches what other compilers are
- // doing, and is necessary to support real-world code.
- const int &test_conv_to_t_2 = ConvToT<int>();
-
- // Example code that would be broken by the standard's rule.
- struct Dest {};
- Dest d1a((ConvToT<Dest>()));
- Dest d1b = ConvToT<Dest>();
- Dest &d2 = (d1a = ConvToT<Dest>());
-
- template<typename Expected>
- struct ConvToTRef {
- template<typename T> operator T&() {
- using Check = T;
- using Check = Expected;
- }
- };
- const int test_conv_to_t_ref_1 = ConvToTRef<int>();
- const int &test_conv_to_t_ref_2 = ConvToTRef<const int>();
-
- Dest d3a((ConvToTRef<const Dest>())); // initialize the copy ctor parameter with 'const Dest&'
- Dest d3b = ConvToTRef<Dest>(); // convert to non-const T via [over.match.copy]/1.2
- Dest &d4 = (d3a = ConvToTRef<const Dest>());
-
- template<typename Expected>
- struct ConvToConstT {
- template<typename T> operator const T() {
- using Check = T;
- using Check = Expected;
- }
- };
- const int test_conv_to_const_t_1 = ConvToConstT<int>();
- const int &test_conv_to_const_t_2 = ConvToConstT<int>();
-
- template<typename Expected>
- struct ConvToConstTRef {
- template<typename T> operator const T&() {
- using Check = T;
- using Check = Expected;
- }
- };
- const int test_conv_to_const_t_ref_1 = ConvToConstTRef<int>();
- const int &test_conv_to_const_t_ref_2 = ConvToConstTRef<int>();
-
- template <typename T, int N> using Arr = T[N];
- struct ConvToArr {
- template <int N>
- operator Arr<int, N> &() {
- static_assert(N == 3, "");
- }
- };
- int (&test_conv_to_arr_1)[3] = ConvToArr(); // ok
- const int (&test_conv_to_arr_2)[3] = ConvToArr(); // ok, with qualification conversion
-
-#if __cplusplus >= 201702L
- template<bool Noexcept, typename T, typename ...U> using Function = T(U...) noexcept(Noexcept);
- template<bool Noexcept> struct ConvToFunction {
- template <typename T, typename ...U> operator Function<Noexcept, T, U...>&(); // expected-note {{candidate}}
- };
- void (&fn1)(int) noexcept(false) = ConvToFunction<false>();
- void (&fn2)(int) noexcept(true) = ConvToFunction<false>(); // expected-error {{no viable}}
- void (&fn3)(int) noexcept(false) = ConvToFunction<true>();
- void (&fn4)(int) noexcept(true) = ConvToFunction<true>();
-
- struct ConvToFunctionDeducingNoexcept {
- template <bool Noexcept, typename T, typename ...U> operator Function<Noexcept, T, U...>&();
- };
- void (&fn5)(int) noexcept(false) = ConvToFunctionDeducingNoexcept();
- void (&fn6)(int) noexcept(true) = ConvToFunctionDeducingNoexcept();
-#endif
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p5.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p5.cpp
deleted file mode 100644
index 8821d538dcbe..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p5.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// RUN: %clang_cc1 -std=c++1z -verify %s
-
-template<typename T, bool B> using Fn = T () noexcept(B);
-
-// - If the original A is a function pointer type, A can be "pointer to
-// function" even if the deduced A is "pointer to noexcept function".
-struct A {
- template<typename T> operator Fn<T, false>*(); // expected-note {{candidate}}
-};
-struct B {
- template<typename T> operator Fn<T, true>*();
-};
-void (*p1)() = A();
-void (*p2)() = B();
-void (*p3)() noexcept = A(); // expected-error {{no viable conversion}}
-void (*p4)() noexcept = B();
-
-// - If the original A is a pointer to member function type, A can be "pointer
-// to member of type function" even if the deduced A is "pointer to member of
-// type noexcept function".
-struct C {
- template<typename T> operator Fn<T, false> A::*(); // expected-note {{candidate}}
-};
-struct D {
- template<typename T> operator Fn<T, true> A::*();
-};
-void (A::*q1)() = C();
-void (A::*q2)() = D();
-void (A::*q3)() noexcept = C(); // expected-error {{no viable conversion}}
-void (A::*q4)() noexcept = D();
-
-// There is no corresponding rule for references.
-// FIXME: This seems like a defect.
-// FIXME: We don't actually implement the final check for equal types at all!
-// Instead, we handle the matching via [over.ics.user]p3:
-// "If the user-defined conversion is specified by a specialization of a
-// conversion function template, the second standard conversion sequence
-// shall have exact match rank."
-// Note that this *does* allow discarding noexcept, since that conversion has
-// Exact Match rank.
-struct E {
- template<typename T> operator Fn<T, false>&(); // expected-note {{candidate}}
-};
-struct F {
- template<typename T> operator Fn<T, true>&();
-};
-void (&r1)() = E();
-void (&r2)() = F();
-void (&r3)() noexcept = E(); // expected-error {{no viable conversion}}
-void (&r4)() noexcept = F();
-
-// FIXME: We reject this for entirely the wrong reason. We incorrectly succeed
-// in deducing T = void, U = G::B, and only fail due to [over.ics.user]p3.
-struct G {
- template<typename, typename> struct A {};
- template<typename U> struct A<U, int> : A<U, void> {};
- struct B { typedef int type; };
-
- template<typename T, typename U = B> operator A<T, typename U::type> *(); // expected-note {{candidate function [with T = void, U = G::B]}}
-};
-G::A<void, void> *g = G(); // expected-error {{no viable conversion}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
deleted file mode 100644
index 99a265af394c..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.funcaddr/p1.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only %s
-
-template<typename T>
- T f0(T, int);
-
-void test_f0() {
- int (*f0a)(int, int) = f0;
- int (*f0b)(int, int) = &f0;
- float (*f0c)(float, int) = &f0;
-}
-
-template<typename T> T f1(T, int);
-template<typename T> T f1(T);
-
-void test_f1() {
- float (*f1a)(float, int) = f1;
- float (*f1b)(float, int) = &f1;
- float (*f1c)(float) = f1;
- float (*f1d)(float) = (f1);
- float (*f1e)(float) = &f1;
- float (*f1f)(float) = (&f1);
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
deleted file mode 100644
index 01155e136aad..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-template <class T> T* f(int); // #1
-template <class T, class U> T& f(U); // #2
-
-void g() {
- int *ip = f<int>(1); // calls #1
-}
-
-template<typename T>
-struct identity {
- typedef T type;
-};
-
-template <class T>
- T* f2(int, typename identity<T>::type = 0);
-template <class T, class U>
- T& f2(U, typename identity<T>::type = 0);
-
-void g2() {
- int* ip = f2<int>(1);
-}
-
-template<class T, class U> struct A { };
-
-template<class T, class U> inline int *f3( U, A<U,T>* p = 0 ); // #1 expected-note{{candidate function [with T = int, U = int]}}
-template< class U> inline float *f3( U, A<U,U>* p = 0 ); // #2 expected-note{{candidate function [with U = int]}}
-
-void g3() {
- float *fp = f3<int>( 42, (A<int,int>*)0 ); // Ok, picks #2.
- f3<int>( 42 ); // expected-error{{call to 'f3' is ambiguous}}
-
-}
-
-namespace PR9006 {
- struct X {
- template <class Get>
- int &f(char const* name, Get fget, char const* docstr = 0);
-
- template <class Get, class Set>
- float &f(char const* name, Get fget, Set fset, char const* docstr = 0);
- };
-
- void test(X x) {
- int &ir = x.f("blah", 0, "blah");
- }
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
deleted file mode 100644
index ec7e8970b1b5..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-// Note: Partial ordering of function templates containing template
-// parameter packs is independent of the number of deduced arguments
-// for those template parameter packs.
-template<class ...> struct Tuple { };
-template<class ... Types> int &g(Tuple<Types ...>); // #1
-template<class T1, class ... Types> float &g(Tuple<T1, Types ...>); // #2
-template<class T1, class ... Types> double &g(Tuple<T1, Types& ...>); // #3
-
-void test_g() {
- int &ir1 = g(Tuple<>());
- float &fr1 = g(Tuple<int, float>());
- double &dr1 = g(Tuple<int, float&>());
- double &dr2 = g(Tuple<int>());
-}
-
-template<class ... Types> int &h(int (*)(Types ...)); // #1
-template<class T1, class ... Types> float &h(int (*)(T1, Types ...)); // #2
-template<class T1, class ... Types> double &h(int (*)(T1, Types& ...)); // #3
-
-void test_h() {
- int &ir1 = h((int(*)())0);
- float &fr1 = h((int(*)(int, float))0);
- double &dr1 = h((int(*)(int, float&))0);
- double &dr2 = h((int(*)(int))0);
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
deleted file mode 100644
index cc129c0a9b2e..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-template<typename T> int &f0(T&);
-template<typename T> float &f0(T&&);
-
-// Core issue 1164
-void test_f0(int i) {
- int &ir0 = f0(i);
- float &fr0 = f0(5);
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p1.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p1.cpp
deleted file mode 100644
index 33d8182ab14e..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p1.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clang_cc1 -verify %s
-
-// an attempt is made to find template argument values that will make P, after
-// substitution of the deduced values, compatible with A
-
-namespace cv_mismatch {
- template<typename> struct X {};
- template<typename T> void f(X<const T>); // expected-note {{cannot deduce a type for 'T' that would make 'const T' equal 'volatile int'}}
- void g() { f(X<volatile int>()); } // expected-error {{no matching}}
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
deleted file mode 100644
index b38ade39edf2..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
-template<typename T> void f(T&&);
-template<> void f(int&) { }
-void (*fp)(int&) = &f;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
deleted file mode 100644
index bf5f96225dad..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p17.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-template<int i> class A { };
-template<short s> void f(A<s>); // expected-note{{candidate template ignored: substitution failure}}
-
-void k1() {
- A<1> a;
- f(a); // expected-error{{no matching function for call}}
- f<1>(a);
-}
-template<const short cs> class B { };
-template<short s> void g(B<s>);
-void k2() {
- B<1> b;
- g(b); // OK: cv-qualifiers are ignored on template parameter types
-}
-
-template<short s> void h(int (&)[s]); // expected-note{{candidate function template not viable: requires 1 argument, but 2 were provided}}
-void k3() {
- int array[5];
- h(array);
- h<5>(array);
-}
-
-template<short s> void h(int (&)[s], A<s>); // expected-note{{candidate template ignored: substitution failure}}
-void k4() {
- A<5> a;
- int array[5];
- h(array, a); // expected-error{{no matching function for call}}
- h<5>(array, a);
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
deleted file mode 100644
index e3a9f5798dbf..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-// If type deduction cannot be done for any P/A pair, or if for any
-// pair the deduction leads to more than one possible set of deduced
-// values, or if different pairs yield different deduced values, or if
-// any template argument remains neither deduced nor explicitly
-// specified, template argument deduction fails.
-
-template<typename ...> struct tuple;
-
-template<typename T, typename U>
-struct same_tuple {
- static const bool value = false;
-};
-
-template<typename ...Types1>
-struct same_tuple<tuple<Types1...>, tuple<Types1...> > {
- static const bool value = true;
-};
-
-int same_tuple_check1[same_tuple<tuple<int, float>, tuple<int, double>>::value? -1 : 1];
-int same_tuple_check2[same_tuple<tuple<float, double>, tuple<float, double>>::value? 1 : -1];
-
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
deleted file mode 100644
index 20e6ea2d7127..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-// Note: Template argument deduction involving parameter packs
-// (14.5.3) can deduce zero or more arguments for each parameter pack.
-
-template<class> struct X {
- static const unsigned value = 0;
-};
-
-template<class R, class ... ArgTypes> struct X<R(int, ArgTypes ...)> {
- static const unsigned value = 1;
-};
-
-template<class ... Types> struct Y {
- static const unsigned value = 0;
-};
-
-template<class T, class ... Types> struct Y<T, Types& ...> {
- static const unsigned value = 1;
-};
-
-template<class ... Types> int f(void (*)(Types ...));
-void g(int, float);
-
-int check0[X<int>::value == 0? 1 : -1]; // uses primary template
-int check1[X<int(int, float, double)>::value == 1? 1 : -1]; // uses partial specialization
-int check2[X<int(float, int)>::value == 0? 1 : -1]; // uses primary template
-int check3[Y<>::value == 0? 1 : -1]; // uses primary template
-int check4[Y<int&, float&, double&>::value == 1? 1 : -1]; // uses partial specialization
-int check5[Y<int, float, double>::value == 0? 1 : -1]; // uses primary template
-int fv = f(g); // okay
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
deleted file mode 100644
index 09b1648e68e7..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-// If the original function parameter associated with A is a function
-// parameter pack and the function parameter associated with P is not
-// a function parameter pack, then template argument deduction fails.
-template<class ... Args> int& f(Args ... args);
-template<class T1, class ... Args> float& f(T1 a1, Args ... args);
-template<class T1, class T2> double& f(T1 a1, T2 a2);
-
-void test_f() {
- int &ir1 = f();
- float &fr1 = f(1, 2, 3);
- double &dr1 = f(1, 2);
-}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
deleted file mode 100644
index 697412995b33..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-
-// FIXME: More bullets to go!
-
-template<typename T, typename U>
-struct has_nondeduced_pack_test {
- static const bool value = false;
-};
-
-template<typename R, typename FirstType, typename ...Types>
-struct has_nondeduced_pack_test<R(FirstType, Types..., int),
- R(FirstType, Types...)> {
- static const bool value = true;
-};
-
-// - A function parameter pack that does not occur at the end of the
-// parameter-declaration-clause.
-//
-// We interpret [temp.deduct.call]p1's
-//
-// "When a function parameter pack appears in a non-deduced context
-// (12.9.2.5), the type of that pack is never deduced."
-//
-// as applying in all deduction contexts, not just [temp.deduct.call],
-// so we do *not* deduce Types from the second argument here. (More
-// precisely, we deduce it as <> when processing the first argument,
-// and then fail because 'int' doesn't match 'double, int'.)
-int check_nondeduced_pack_test0[
- has_nondeduced_pack_test<int(float, double, int),
- int(float, double)>::value? -1 : 1];
-
-template<typename ...T> void has_non_trailing_pack(T ..., int);
-void (*ptr_has_non_trailing_pack)(char, int) = has_non_trailing_pack<char>;
-
-template<typename ...T, typename U> void has_non_trailing_pack_and_more(T ..., U); // expected-note {{failed}}
-void (*ptr_has_non_trailing_pack_and_more_1)(float, double, int) = &has_non_trailing_pack_and_more<float, double>;
-void (*ptr_has_non_trailing_pack_and_more_2)(float, double, int) = &has_non_trailing_pack_and_more<float>; // expected-error {{does not match}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
deleted file mode 100644
index 6ef8e2fd5ecd..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
-
-// Deductions specific to C++0x.
-
-template<typename T>
-struct member_pointer_kind {
- static const unsigned value = 0;
-};
-
-template<class C, typename R, typename ...Args>
-struct member_pointer_kind<R (C::*)(Args...)> {
- static const unsigned value = 1;
-};
-
-template<class C, typename R, typename ...Args>
-struct member_pointer_kind<R (C::*)(Args...) &> {
- static const unsigned value = 2;
-};
-
-template<class C, typename R, typename ...Args>
-struct member_pointer_kind<R (C::*)(Args...) &&> {
- static const unsigned value = 3;
-};
-
-template<class C, typename R, typename ...Args>
-struct member_pointer_kind<R (C::*)(Args...) const> {
- static const unsigned value = 4;
-};
-
-template<class C, typename R, typename ...Args>
-struct member_pointer_kind<R (C::*)(Args...) const &> {
- static const unsigned value = 5;
-};
-
-template<class C, typename R, typename ...Args>
-struct member_pointer_kind<R (C::*)(Args...) const &&> {
- static const unsigned value = 6;
-};
-
-struct X { };
-
-static_assert(member_pointer_kind<int (X::*)(int)>::value == 1, "");
-static_assert(member_pointer_kind<int (X::*)(int) &>::value == 2, "");
-static_assert(member_pointer_kind<int (X::*)(int) &&>::value == 3, "");
-static_assert(member_pointer_kind<int (X::*)(int) const>::value == 4, "");
-static_assert(member_pointer_kind<int (X::*)(int) const&>::value == 5, "");
-static_assert(member_pointer_kind<int (X::*)(int) const&&>::value == 6, "");
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
deleted file mode 100644
index fccac8f1e5a4..000000000000
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-
-template<typename ...Types> struct tuple;
-template<unsigned> struct unsigned_c;
-
-template<typename T, typename U>
-struct is_same {
- static const bool value = false;
-};
-
-template<typename T>
-struct is_same<T, T> {
- static const bool value = true;
-};
-
-namespace PackExpansionNotAtEnd {
- template<typename T, typename U>
- struct tuple_same_with_int {
- static const bool value = false;
- };
-
- template<typename ...Types>
- struct tuple_same_with_int<tuple<Types...>, tuple<Types..., int>> {
- static const bool value = true;
- };
-
- int tuple_same_with_int_1[tuple_same_with_int<tuple<int, float, double>,
- tuple<int, float, double, int>
- >::value? 1 : -1];
-
- template<typename ... Types> struct UselessPartialSpec;
-
- template<typename ... Types, // expected-note{{non-deducible template parameter 'Types'}}
- typename Tail> // expected-note{{non-deducible template parameter 'Tail'}}
- struct UselessPartialSpec<Types..., Tail>; // expected-error{{class template partial specialization contains template parameters that cannot be deduced; this partial specialization will never be used}}
-}
-
-// When a pack expansion occurs within a template argument list, the entire
-// list is a non-deduced context. For the corresponding case in a function
-// parameter list, only that parameter is non-deduced.
-//
-// FIXME: It's not clear that this difference is intended, but the wording is
-// explicit.
-namespace PackExpansionNotAtEndFunctionVersusTemplate {
- template<typename ...T> struct X {};
- template<typename ...T, typename U> void f1(void(T..., U));
- // expected-note@+1 {{couldn't infer template argument 'U'}}
- template<typename ...T, typename U> void f2(X<T..., U>); // FIXME: ill-formed, U is not deducible
-
- void g(int, int, int);
- X<int, int, int> h;
- void test() {
- // This is deducible: the T... parameter is a non-deduced context, but
- // that's OK because we don't need to deduce it.
- f1<int, int>(g);
- // This is not deducible: the T... parameter renders the entire
- // template-argument-list a non-deduced context, so U is not deducible.
- f2<int, int>(h); // expected-error {{no matching function}}
- }
-
- template<typename T> struct Y;
- template<typename ...T, // expected-note {{non-deducible template parameter 'T'}}
- typename U>
- struct Y<void(T..., U)> {}; // expected-error {{cannot be deduced}}
- template<typename ...T, // expected-note {{non-deducible template parameter 'T'}}
- typename U> // expected-note {{non-deducible template parameter 'U'}}
- struct Y<X<T..., U>>; // expected-error {{cannot be deduced}}
- // FIXME: T is not deducible here, due to [temp.deduct.call]p1:
- // "When a function parameter pack appears in a non-deduced context,
- // the type of that pack is never deduced."
- template<typename ...T,
- typename U>
- struct Y<void(T..., U, T...)> {};
-}
-
-namespace DeduceNonTypeTemplateArgsInArray {
- template<typename ...ArrayTypes>
- struct split_arrays;
-
- template<typename ...ElementTypes, unsigned ...Bounds>
- struct split_arrays<ElementTypes[Bounds]...> {
- typedef tuple<ElementTypes...> element_types;
-
- // FIXME: Would like to have unsigned_tuple<Bounds...> here.
- typedef tuple<unsigned_c<Bounds>...> bounds_types;
- };
-
- int check1[is_same<split_arrays<int[1], float[2], double[3]>::element_types,
- tuple<int, float, double>>::value? 1 : -1];
- int check2[is_same<split_arrays<int[1], float[2], double[3]>::bounds_types,
- 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 {{deduced type 'X<[...], (default) int>' of 1st parameter does not match adjusted type 'X<[...], double>' of argument [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'}}
- }
-}