/* Digest the specified initializer into an expression. */
value = digest_init (type, init, (tree *) 0);
-
- /* Store the expression if valid; else report error. */
-
- if (TREE_CODE (value) == ERROR_MARK)
- ;
- /* Other code expects that initializers for objects of types that need
- constructing never make it into DECL_INITIAL, and passes 'init' to
- build_aggr_init without checking DECL_INITIAL. So just return. */
- else if (TYPE_NEEDS_CONSTRUCTING (type))
- return build2 (INIT_EXPR, type, decl, value);
- else if (TREE_STATIC (decl)
- && (TREE_SIDE_EFFECTS (value)
- || ! initializer_constant_valid_p (value, TREE_TYPE (value))))
+ /* If the initializer is not a constant, fill in DECL_INITIAL with
+ the bits that are constant, and then return an expression that
+ will perform the dynamic initialization. */
+ if (value != error_mark_node
+ && (TREE_SIDE_EFFECTS (value)
+ || ! initializer_constant_valid_p (value, TREE_TYPE (value))))
return split_nonconstant_init (decl, value);
-
- /* Store the VALUE in DECL_INITIAL. If we're building a
- statement-tree we will actually expand the initialization later
- when we output this function. */
+ /* If the value is a constant, just put it in DECL_INITIAL. If DECL
+ is an automatic variable, the middle end will turn this into a
+ dynamic initialization later. */
DECL_INITIAL (decl) = value;
return NULL_TREE;
}