From 8f413ae21e40877f5f6926d4de79966121edf501 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Jan 2015 16:04:28 -0500 Subject: [PATCH] re PR c++/64520 (ICE with std::initializer_list) PR c++/64520 * pt.c (unify): Don't try to deduce to std::initializer_list. From-SVN: r219557 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 8 +++++++- gcc/testsuite/g++.dg/cpp0x/initlist91.C | 8 ++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist91.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 14e1fb323c2..0e94fe136a4 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 d8652fb3d21..3ac93db948a 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 00000000000..1387557ab2d --- /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 "" } -- 2.30.2