aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c854cb7..6c5b979 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7592,7 +7592,13 @@ obscure_complex_init (decl, init)
NULL_TREE);
else
#endif
- DECL_INITIAL (decl) = error_mark_node;
+ {
+ if (zero_init_p (TREE_TYPE (decl)))
+ DECL_INITIAL (decl) = error_mark_node;
+ /* Otherwise, force_store_init_value will have already stored a
+ zero-init initializer in DECL_INITIAL, that should be
+ retained. */
+ }
return init;
}
@@ -7838,8 +7844,16 @@ check_initializer (decl, init)
if (init)
init = obscure_complex_init (decl, init);
}
+ else if (!DECL_EXTERNAL (decl) && !zero_init_p (type))
+ {
+ force_store_init_value (decl, build_forced_zero_init (type));
+
+ if (init)
+ goto process_init;
+ }
else if (init)
{
+ process_init:
if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type))
{
if (TREE_CODE (type) == ARRAY_TYPE)