* 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
+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>
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,
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;
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);
}
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). */
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;
--- /dev/null
+// PR c++/67631
+// { dg-do compile { target c++11 } }
+
+struct X
+{
+ explicit operator unsigned ();
+};
+unsigned foo ()
+{
+ return unsigned{ X () };
+}