Commit 408249b2 by Jason Merrill Committed by Jason Merrill

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
parent 4b55a782
2014-01-31 Jason Merrill <jason@redhat.com>
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.
......
......@@ -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;
......
// PR c++/59646
// { dg-require-effective-target c++11 }
#include <initializer_list>
struct A {};
std::initializer_list<volatile A> x = {{}};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment