re PR c++/64520 (ICE with std::initializer_list)

PR c++/64520
	* pt.c (unify): Don't try to deduce to std::initializer_list<T...>.

From-SVN: r219557
This commit is contained in:
Jason Merrill 2015-01-13 16:04:28 -05:00 committed by Jason Merrill
parent 2001028ad3
commit 8f413ae21e
3 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2015-01-13 Jason Merrill <jason@redhat.com>
PR c++/64520
* pt.c (unify): Don't try to deduce to std::initializer_list<T...>.
2015-01-12 Jason Merrill <jason@redhat.com>
PR c++/64547

View File

@ -17854,7 +17854,13 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
if (TREE_CODE (parm) == ARRAY_TYPE)
elttype = TREE_TYPE (parm);
else
elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0);
{
elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0);
/* Deduction is defined in terms of a single type, so just punt
on the (bizarre) std::initializer_list<T...>. */
if (PACK_EXPANSION_P (elttype))
return unify_success (explain_p);
}
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg), i, elt)
{

View File

@ -0,0 +1,8 @@
// PR c++/64520
// { dg-do compile { target c++11 } }
#include <initializer_list>
struct A {
template <typename... B> A(std::initializer_list<B...>);
};
A a { 0 }; // { dg-error "" }