diff options
author | Jason Merrill <jason@redhat.com> | 2019-03-05 17:20:41 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-03-05 17:20:41 -0500 |
commit | 507318f109624f58d4bf554c3ad284cdf09324e3 (patch) | |
tree | 49ed38aa621b2eab775ddb3e1339416da189332f /gcc/gimplify.c | |
parent | dbcd32f889365695b3ed835a3a7de5d23048f43b (diff) | |
download | gcc-507318f109624f58d4bf554c3ad284cdf09324e3.zip gcc-507318f109624f58d4bf554c3ad284cdf09324e3.tar.gz gcc-507318f109624f58d4bf554c3ad284cdf09324e3.tar.bz2 |
PR c++/86485 - -Wmaybe-unused with empty class ?:
The problem in this testcase is that the front end expects an rvalue
COND_EXPR to initialize a single temporary from one of the arms. But
because gimplify_cond_expr used MODIFY_EXPR, instead the arms would each
create their own temporary and then copy that into the common temporary.
So, let's use INIT_EXPR instead.
* gimplify.c (gimplify_cond_expr): Use INIT_EXPR.
From-SVN: r269403
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 983635b..fa85b1c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4024,11 +4024,11 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback) /* Build the new then clause, `tmp = then_;'. But don't build the assignment if the value is void; in C++ it can be if it's a throw. */ if (!VOID_TYPE_P (TREE_TYPE (then_))) - TREE_OPERAND (expr, 1) = build2 (MODIFY_EXPR, type, tmp, then_); + TREE_OPERAND (expr, 1) = build2 (INIT_EXPR, type, tmp, then_); /* Similarly, build the new else clause, `tmp = else_;'. */ if (!VOID_TYPE_P (TREE_TYPE (else_))) - TREE_OPERAND (expr, 2) = build2 (MODIFY_EXPR, type, tmp, else_); + TREE_OPERAND (expr, 2) = build2 (INIT_EXPR, type, tmp, else_); TREE_TYPE (expr) = void_type_node; recalculate_side_effects (expr); |