diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 14e1fb323c26..0e94fe136a4c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Jason Merrill + + PR c++/64520 + * pt.c (unify): Don't try to deduce to std::initializer_list. + 2015-01-12 Jason Merrill PR c++/64547 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d8652fb3d214..3ac93db948a3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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. */ + if (PACK_EXPANSION_P (elttype)) + return unify_success (explain_p); + } FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg), i, elt) { diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist91.C b/gcc/testsuite/g++.dg/cpp0x/initlist91.C new file mode 100644 index 000000000000..1387557ab2d2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist91.C @@ -0,0 +1,8 @@ +// PR c++/64520 +// { dg-do compile { target c++11 } } + +#include +struct A { + template A(std::initializer_list); +}; +A a { 0 }; // { dg-error "" }