+2020-04-07 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/90996
+ * tree.c (replace_placeholders): Look through all handled components,
+ not just COMPONENT_REFs.
+ * typeck2.c (process_init_constructor_array): Propagate
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
+ the array initializer.
+
2020-04-07 Jakub Jelinek <jakub@redhat.com>
PR c++/94512
/* If the object isn't a (member of a) class, do nothing. */
tree op0 = obj;
- while (TREE_CODE (op0) == COMPONENT_REF)
+ while (handled_component_p (op0))
op0 = TREE_OPERAND (op0, 0);
if (!CLASS_TYPE_P (strip_array_types (TREE_TYPE (op0))))
return exp;
= massage_init_elt (TREE_TYPE (type), ce->value, nested, flags,
complain);
+ if (TREE_CODE (ce->value) == CONSTRUCTOR
+ && CONSTRUCTOR_PLACEHOLDER_BOUNDARY (ce->value))
+ {
+ /* Shift CONSTRUCTOR_PLACEHOLDER_BOUNDARY from the element initializer
+ up to the array initializer, so that the call to
+ replace_placeholders from store_init_value can resolve any
+ PLACEHOLDER_EXPRs inside this element initializer. */
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (ce->value) = 0;
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (init) = 1;
+ }
+
gcc_checking_assert
(ce->value == error_mark_node
|| (same_type_ignoring_top_level_qualifiers_p
/* The default zero-initialization is fine for us; don't
add anything to the CONSTRUCTOR. */
next = NULL_TREE;
+ else if (TREE_CODE (next) == CONSTRUCTOR
+ && CONSTRUCTOR_PLACEHOLDER_BOUNDARY (next))
+ {
+ /* As above. */
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (next) = 0;
+ CONSTRUCTOR_PLACEHOLDER_BOUNDARY (init) = 1;
+ }
}
else if (!zero_init_p (TREE_TYPE (type)))
next = build_zero_init (TREE_TYPE (type),