Commit 0bdc4c1c by Jason Merrill Committed by Jason Merrill

PR c++/67631 - list-init and explicit conversions

	* semantics.c (finish_compound_literal): Call digest_init_flags.
	* typeck2.c (digest_init_flags): Add complain parm.
	(store_init_value): Pass it.

From-SVN: r242603
parent 1b2e0303
2016-11-18 Jason Merrill <jason@redhat.com>
PR c++/67631 - list-init and explicit conversions
* semantics.c (finish_compound_literal): Call digest_init_flags.
* typeck2.c (digest_init_flags): Add complain parm.
(store_init_value): Pass it.
2016-11-18 Richard Sandiford <richard.sandiford@arm.com>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
......
......@@ -6839,7 +6839,7 @@ extern tree store_init_value (tree, tree, vec<tree, va_gc>**, int);
extern tree split_nonconstant_init (tree, tree);
extern bool check_narrowing (tree, tree, tsubst_flags_t);
extern tree digest_init (tree, tree, tsubst_flags_t);
extern tree digest_init_flags (tree, tree, int);
extern tree digest_init_flags (tree, tree, int, tsubst_flags_t);
extern tree digest_nsdmi_init (tree, tree);
extern tree build_scoped_ref (tree, tree, tree *);
extern tree build_x_arrow (location_t, tree,
......
......@@ -2713,7 +2713,8 @@ finish_compound_literal (tree type, tree compound_literal,
if (type == error_mark_node)
return error_mark_node;
}
compound_literal = digest_init (type, compound_literal, complain);
compound_literal = digest_init_flags (type, compound_literal, LOOKUP_NORMAL,
complain);
if (TREE_CODE (compound_literal) == CONSTRUCTOR)
TREE_HAS_CONSTRUCTOR (compound_literal) = true;
......
......@@ -794,7 +794,7 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags)
value = init;
else
/* Digest the specified initializer into an expression. */
value = digest_init_flags (type, init, flags);
value = digest_init_flags (type, init, flags, tf_warning_or_error);
value = extend_ref_init_temps (decl, value, cleanups);
......@@ -1165,9 +1165,9 @@ digest_init (tree type, tree init, tsubst_flags_t complain)
}
tree
digest_init_flags (tree type, tree init, int flags)
digest_init_flags (tree type, tree init, int flags, tsubst_flags_t complain)
{
return digest_init_r (type, init, false, flags, tf_warning_or_error);
return digest_init_r (type, init, false, flags, complain);
}
/* Process the initializer INIT for an NSDMI DECL (a FIELD_DECL). */
......@@ -1183,7 +1183,7 @@ digest_nsdmi_init (tree decl, tree init)
if (BRACE_ENCLOSED_INITIALIZER_P (init)
&& CP_AGGREGATE_TYPE_P (type))
init = reshape_init (type, init, tf_warning_or_error);
init = digest_init_flags (type, init, flags);
init = digest_init_flags (type, init, flags, tf_warning_or_error);
if (TREE_CODE (init) == TARGET_EXPR)
/* This represents the whole initialization. */
TARGET_EXPR_DIRECT_INIT_P (init) = true;
......
// PR c++/67631
// { dg-do compile { target c++11 } }
struct X
{
explicit operator unsigned ();
};
unsigned foo ()
{
return unsigned{ 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