Commit d6027563 by Jason Merrill Committed by Jason Merrill

re PR c++/35722 ([C++0x] Variadic templates expansion into non-variadic class template)

	PR c++/35722
	Implement N2555 (expanding pack expansion to fixed parm list)
	* pt.c (coerce_template_parms): Allow expanding a pack expansion
	to a fixed-length argument list.
	(unify_pack_expansion): Handle explicit args properly.
	(unify) [TREE_VEC]: Handle pack expansions here.
	[TYPE_ARGUMENT_PACK]: Not here.
	(tsubst_pack_expansion): Don't try to do partial substitution.
	(pack_deducible_p): New.
	(fn_type_unification): Use it.
	(find_parameter_packs_r): Take the TYPE_MAIN_VARIANT
	of a type parameter.
	(check_non_deducible_conversion): Split from type_unification_real.
	(unify_one_argument): Split from type_unification_real...
	(unify_pack_expansion): ...and here.  Drop call_args_p parm.
	(type_unification_real, unify, more_specialized_fn): Adjust.

From-SVN: r179436
parent f10eaa2d
2011-10-02 Jason Merrill <jason@redhat.com>
PR c++/35722
Implement N2555 (expanding pack expansion to fixed parm list)
* pt.c (coerce_template_parms): Allow expanding a pack expansion
to a fixed-length argument list.
(unify_pack_expansion): Handle explicit args properly.
(unify) [TREE_VEC]: Handle pack expansions here.
[TYPE_ARGUMENT_PACK]: Not here.
(tsubst_pack_expansion): Don't try to do partial substitution.
(pack_deducible_p): New.
(fn_type_unification): Use it.
(find_parameter_packs_r): Take the TYPE_MAIN_VARIANT
of a type parameter.
(check_non_deducible_conversion): Split from type_unification_real.
(unify_one_argument): Split from type_unification_real...
(unify_pack_expansion): ...and here. Drop call_args_p parm.
(type_unification_real, unify, more_specialized_fn): Adjust.
* class.c (fixed_type_or_null): Handle NSDMI.
* method.c (walk_field_subobs): Disable NSDMI noexcept checking
for now.
......
2011-10-02 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/variadic65.C: Remove xfails.
* g++.dg/cpp0x/variadic82.C: Remove xfails.
* g++.dg/cpp0x/variadic83.C: Remove xfails.
* g++.dg/cpp0x/variadic105.C: Remove xfails.
* g++.dg/cpp0x/nsdmi5.C: New.
2011-10-02 Richard Sandiford <rdsandiford@googlemail.com>
......
// { dg-options -std=c++0x }
template<class T, class U> struct A { };
template<class... T, class ... U> void f( A<T,U>... p);
void g() {
f<int>(
A<int,unsigned>(),
A<short,unsigned short>()
);
}
// { dg-options -std=c++0x }
template <class... T>
void f(T..., int, T...) { }
int main()
{
f(0);
f<int>(0,0,0);
f<int,int>(0,0,0,0,0);
f(0,0,0); // { dg-error "" }
}
......@@ -20,6 +20,6 @@ struct call_sum {
int main() {
// This shouldn't be an error; this is bug 35722.
reverse<call_sum>(1,2); // { dg-bogus "no match" "" { xfail *-*-* } }
// { dg-bogus "sorry, unimplemented" "candidate explanation" { xfail *-*-* } 6 }
reverse<call_sum>(1,2); // { dg-bogus "no match" "" }
// { dg-bogus "sorry, unimplemented" "candidate explanation" { target *-*-* } 6 }
}
// { dg-options -std=c++0x }
template <class T> struct A { typedef T type; };
template <template <class...> class T, class... U>
void f(typename T<U...>::type);
int main()
{
f<A,int>(42);
}
// This should fail deduction, before it produces a candidate.
// { dg-options -std=c++0x }
template <class... T>
void f(T... ts); // { dg-message "deduction" }
struct B { };
int main()
{
f<int>(B(), 1); // { dg-error "" }
}
......@@ -5,6 +5,5 @@ void get_ith(const Args&... args); // { dg-message "note" }
void f()
{
get_ith<1, float>(1, 2.0, 'x');
get_ith<1, int, double, char, int>(1, 2.0, 'x'); // { dg-error "no matching function" }
// { dg-message "candidate" "candidate note" { target *-*-* } 8 }
get_ith<1, int, double, char, int>(1, 2.0, 'x'); // { dg-error "too few arguments" }
}
......@@ -5,4 +5,9 @@ template<typename T1 = unused, typename T2 = unused, typename T3 = unused,
struct tuple {};
template<typename... Args>
void foo(tuple<Args...>) { } // { dg-bogus "cannot expand" "" { xfail *-*-* } }
tuple<Args...> foo() { } // { dg-bogus "cannot expand" "" }
int main()
{
foo<int,int,int,int,int,int>();
}
......@@ -3,9 +3,9 @@
template<typename> struct A;
template<typename... T> struct A<T*...> // { dg-bogus "cannot expand" "" { xfail *-*-* } }
template<typename... T> struct A<T*...> // { dg-bogus "cannot expand" "" }
{
struct B;
};
A<void*> a; // { dg-bogus "incomplete type" "" { xfail *-*-* } }
A<void*> a; // { dg-bogus "incomplete type" "" }
......@@ -3,6 +3,6 @@
template<typename> struct A;
template<typename... T> struct A<T...> { }; // { dg-bogus "cannot expand" "" { xfail *-*-* } }
template<typename... T> struct A<T...> { }; // { dg-bogus "cannot expand" "" }
A<int> a; // { dg-bogus "incomplete type" "" { xfail *-*-* } }
A<int> a; // { dg-bogus "incomplete type" "" }
2011-09-29 Jason Merrill <jason@redhat.com>
* testsuite/util/testsuite_tr1.h (test_property): Avoid
ambguity.
2011-10-01 François Dumont <fdumont@gcc.gnu.org>
* include/debug/vector (vector<>::erase(iterator, iterator): Check
......
......@@ -68,13 +68,14 @@ namespace __gnu_test
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<template<typename...> class Property, typename... Types>
template<template<typename...> class Property,
typename Type1, typename... Types>
bool
test_property(typename Property<Types...>::value_type value)
test_property(typename Property<Type1, Types...>::value_type value)
{
bool ret = true;
ret &= Property<Types...>::value == value;
ret &= Property<Types...>::type::value == value;
ret &= Property<Type1, Types...>::value == value;
ret &= Property<Type1, Types...>::type::value == value;
return ret;
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment