From: Jason Merrill Date: Fri, 21 Feb 2014 14:56:20 +0000 (-0500) Subject: DR 1591 PR c++/60051 X-Git-Tag: releases/gcc-4.9.0~776 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9cd655135c621b4df78551676eefe6ebd3e6390;p=thirdparty%2Fgcc.git DR 1591 PR c++/60051 DR 1591 PR c++/60051 * pt.c (unify): Only unify if deducible. Handle 0-length list. From-SVN: r207998 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f041441aa3b..8a2cb1630f15 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-02-21 Jason Merrill + DR 1591 + PR c++/60051 + * pt.c (unify): Only unify if deducible. Handle 0-length list. + PR c++/60250 * parser.c (cp_parser_direct_declarator): Don't wrap a type-dependent expression in a NOP_EXPR. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4cf387a1d688..0f576a52aea2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -17262,14 +17262,16 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, explain_p); } - if (TREE_CODE (parm) == ARRAY_TYPE) + if (TREE_CODE (parm) == ARRAY_TYPE + && deducible_array_bound (TYPE_DOMAIN (parm))) { /* Also deduce from the length of the initializer list. */ tree max = size_int (CONSTRUCTOR_NELTS (arg)); tree idx = compute_array_index_type (NULL_TREE, max, tf_none); - if (TYPE_DOMAIN (parm) != NULL_TREE) - return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), - idx, explain_p); + if (idx == error_mark_node) + return unify_invalid (explain_p); + return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), + idx, explain_p); } /* If the std::initializer_list deduction worked, replace the diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist80.C b/gcc/testsuite/g++.dg/cpp0x/initlist80.C new file mode 100644 index 000000000000..7947f1f8197b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist80.C @@ -0,0 +1,6 @@ +// PR c++/60051 +// { dg-require-effective-target c++11 } + +#include + +auto x[2] = {}; // { dg-error "" }