From: Jason Merrill Date: Fri, 31 Jan 2014 15:20:12 +0000 (-0500) Subject: re PR c++/59646 (ICE with volatile in initializer list) X-Git-Tag: releases/gcc-4.9.0~1189 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=408249b2e2bc8ddc31d9041c31c3782392b54c3f;p=thirdparty%2Fgcc.git re PR c++/59646 (ICE with volatile in initializer list) PR c++/59646 * call.c (convert_like_real) [ck_aggr]: Set TARGET_EXPR_LIST_INIT_P. [ck_list]: Check for error_mark_node. (build_aggr_conv): Set LOOKUP_NO_NARROWING and check_narrowing. From-SVN: r207346 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a9e56a472117..1fd5a6808d85 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2014-01-31 Jason Merrill + PR c++/59646 + * call.c (convert_like_real) [ck_aggr]: Set TARGET_EXPR_LIST_INIT_P. + [ck_list]: Check for error_mark_node. + (build_aggr_conv): Set LOOKUP_NO_NARROWING and check_narrowing. + PR c++/57043 * pt.c (fn_type_unification): Don't do DEDUCE_EXACT check during partial ordering. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 71f95dbed4a2..d4e8a285b9d1 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -886,6 +886,8 @@ build_aggr_conv (tree type, tree ctor, int flags, tsubst_flags_t complain) if (ctor == error_mark_node) return NULL; + flags |= LOOKUP_NO_NARROWING; + for (; field; field = next_initializable_field (DECL_CHAIN (field))) { tree ftype = TREE_TYPE (field); @@ -926,6 +928,7 @@ build_aggr_conv (tree type, tree ctor, int flags, tsubst_flags_t complain) c->type = type; c->rank = cr_exact; c->user_conv_p = true; + c->check_narrowing = true; c->u.next = NULL; return c; } @@ -6111,6 +6114,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, to avoid the error about taking the address of a temporary. */ array = cp_build_addr_expr (array, complain); array = cp_convert (build_pointer_type (elttype), array, complain); + if (array == error_mark_node) + return error_mark_node; /* Build up the initializer_list object. */ totype = complete_type (totype); @@ -6135,8 +6140,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, return fold_if_not_in_template (expr); } expr = reshape_init (totype, expr, complain); - return get_target_expr_sfinae (digest_init (totype, expr, complain), + expr = get_target_expr_sfinae (digest_init (totype, expr, complain), complain); + if (expr != error_mark_node) + TARGET_EXPR_LIST_INIT_P (expr) = true; + return expr; default: break; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist79.C b/gcc/testsuite/g++.dg/cpp0x/initlist79.C new file mode 100644 index 000000000000..5a1914dda679 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist79.C @@ -0,0 +1,8 @@ +// PR c++/59646 +// { dg-require-effective-target c++11 } + +#include + +struct A {}; + +std::initializer_list x = {{}};