aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index d9fb0ea..b558742 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1733,11 +1733,6 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
&& !DIRECT_LIST_INIT_P (init))
flags |= LOOKUP_ONLYCONVERTING;
- if ((VAR_P (exp) || TREE_CODE (exp) == PARM_DECL)
- && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (type)))
- /* Just know that we've seen something for this node. */
- TREE_USED (exp) = 1;
-
is_global = begin_init_stmts (&stmt_expr, &compound_stmt);
destroy_temps = stmts_are_full_exprs_p ();
current_stmt_tree ()->stmts_are_full_exprs_p = 0;
@@ -1748,6 +1743,12 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
TREE_READONLY (exp) = was_const;
TREE_THIS_VOLATILE (exp) = was_volatile;
+ if ((VAR_P (exp) || TREE_CODE (exp) == PARM_DECL)
+ && TREE_SIDE_EFFECTS (stmt_expr)
+ && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (type)))
+ /* Just know that we've seen something for this node. */
+ TREE_USED (exp) = 1;
+
return stmt_expr;
}