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.cpp27
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp68
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp88
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp46
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp22
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp31
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp27
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp10
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp4
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp23
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp31
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp14
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp22
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp47
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp55
16 files changed, 513 insertions, 4 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
new file mode 100644
index 0000000..46d70b6
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+namespace ParameterPacksWithFunctions {
+ template<typename ...> struct count;
+
+ template<typename Head, typename ...Tail>
+ struct count<Head, Tail...> {
+ static const unsigned value = 1 + count<Tail...>::value;
+ };
+
+ template<>
+ struct count<> {
+ static const unsigned value = 0;
+ };
+
+ template<unsigned> struct unsigned_c { };
+
+ template<typename ... Types>
+ unsigned_c<count<Types...>::value> f();
+
+ void test_f() {
+ unsigned_c<0> uc0a = f(); // okay, deduced to an empty pack
+ unsigned_c<0> uc0b = f<>();
+ unsigned_c<1> uc1 = f<int>();
+ unsigned_c<2> uc2 = f<float, double>();
+ }
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
index eb5465c..9ec8f0c 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
@@ -33,4 +33,4 @@ template <typename T> void g(T);
template <typename T> void g(T, T);
int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \
- // expected-error{{cannot determine the type of an overloaded function}}
+ // expected-error{{cannot resolve overloaded function from context}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
new file mode 100644
index 0000000..b38cc27
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -std=c++0x -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 ...Args>
+typename get_nth_type<0, Args...>::type first_arg(Args...);
+
+template<typename ...Args>
+typename get_nth_type<1, Args...>::type second_arg(Args...);
+
+// Test explicit specification of function template arguments.
+void test_explicit_spec_simple() {
+ int *ip1 = first_arg<int *>(0);
+ int *ip2 = first_arg<int *, float*>(0, 0);
+ float *fp1 = first_arg<float *, double*, int*>(0, 0, 0);
+}
+
+// Template argument deduction can extend the sequence of template
+// arguments corresponding to a template parameter pack, even when the
+// sequence contains explicitly specified template arguments.
+void test_explicit_spec_extension(double *dp) {
+ int *ip1 = first_arg<int *>(0, 0);
+ int *ip2 = first_arg<int *, float*>(0, 0, 0, 0);
+ float *fp1 = first_arg<float *, double*, int*>(0, 0, 0);
+ int *i1 = second_arg<float *>(0, (int*)0, 0);
+ double *dp1 = first_arg<>(dp);
+}
+
+template<typename ...Types>
+struct tuple { };
+
+template<typename ...Types>
+void accept_tuple(tuple<Types...>);
+
+void test_explicit_spec_extension_targs(tuple<int, float, double> t3) {
+ accept_tuple(t3);
+ accept_tuple<int, float, double>(t3);
+ accept_tuple<int>(t3);
+ accept_tuple<int, float>(t3);
+}
+
+template<typename R, typename ...ParmTypes>
+void accept_function_ptr(R(*)(ParmTypes...));
+
+void test_explicit_spec_extension_funcparms(int (*f3)(int, float, double)) {
+ accept_function_ptr(f3);
+ accept_function_ptr<int>(f3);
+ accept_function_ptr<int, int>(f3);
+ accept_function_ptr<int, int, float>(f3);
+ accept_function_ptr<int, int, float, double>(f3);
+}
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
new file mode 100644
index 0000000..8933b63
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
@@ -0,0 +1,88 @@
+// RUN: %clang_cc1 -std=c++0x -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();
+}
+
+
+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}}
+
+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'}}
+}
+
+// For a function parameter pack that does not occur at the end of the
+// parameter-declaration-list, the type of the parameter pack is a
+// non-deduced context.
+template<typename ...Types> struct tuple { };
+
+template<typename ...Types>
+void pack_not_at_end(tuple<Types...>, Types... values, int);
+
+void test_pack_not_at_end(tuple<int*, double*> t2) {
+ pack_not_at_end(t2, 0, 0, 0);
+}
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
new file mode 100644
index 0000000..f18a74a
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+
+// If P is an rvalue reference to a cv-unqualified template parameter
+// 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'}}
+}
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
index 19962c5..3c22cf3 100644
--- 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
@@ -101,3 +101,25 @@ void test_f4(D d, E e, F f, G g) {
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
+ }
+}
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
index 99ade4b..01155e1 100644
--- 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
@@ -13,10 +13,35 @@ struct identity {
};
template <class T>
- T* f2(int, typename identity<T>::type = 0); // expected-note{{candidate}}
+ T* f2(int, typename identity<T>::type = 0);
template <class T, class U>
- T& f2(U, typename identity<T>::type = 0); // expected-note{{candidate}}
+ T& f2(U, typename identity<T>::type = 0);
void g2() {
- f2<int>(1); // expected-error{{ambiguous}}
+ 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
new file mode 100644
index 0000000..1168100
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// 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
new file mode 100644
index 0000000..46ea4db
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+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/p10-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
new file mode 100644
index 0000000..9d342c8
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+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/p2-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
new file mode 100644
index 0000000..198f11f
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// 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
new file mode 100644
index 0000000..247b981
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// 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
new file mode 100644
index 0000000..4326a69
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// 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
new file mode 100644
index 0000000..cf68a01
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=c++0x -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.
+int check_nondeduced_pack_test0[
+ has_nondeduced_pack_test<int(float, double, int),
+ int(float, double)>::value? 1 : -1];
+
+
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
new file mode 100644
index 0000000..a9173fd
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// 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
new file mode 100644
index 0000000..5087224
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -std=c++0x -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-warning{{class template partial specialization contains template parameters that can not be deduced; this partial specialization will never be used}}
+}
+
+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];
+}
OpenPOWER on IntegriCloud