PR c++/79937
commit7604a798428266cbeb56501b8f0f967676fe1205
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Mar 2018 12:46:12 +0000 (16 12:46 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Mar 2018 12:46:12 +0000 (16 12:46 +0000)
tree1139d8cfc2b9466af7e0ef552bbdca551cdc549b
parent91735070a1791c892b2b24755568186db7a14f69
PR c++/79937
PR c++/82410
* tree.h (TARGET_EXPR_NO_ELIDE): Define.
* gimplify.c (gimplify_modify_expr_rhs): Don't elide TARGET_EXPRs with
TARGET_EXPR_NO_ELIDE flag set unless *expr_p is INIT_EXPR.

* cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
(find_placeholder): Declare.
* tree.c (struct replace_placeholders_t): Add exp member.
(replace_placeholders_r): Don't walk into ctors with
CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
d->exp.  Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
(replace_placeholders): Initialize data.exp.
(find_placeholders_r, find_placeholders): New functions.
* typeck2.c (process_init_constructor_record,
process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
if adding NSDMI on which find_placeholder returns true.
* call.c (build_over_call): Don't call replace_placeholders here.
* cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
TARGET_EXPR_INITIAL.
(cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
ctor.

* g++.dg/cpp1y/pr79937-1.C: New test.
* g++.dg/cpp1y/pr79937-2.C: New test.
* g++.dg/cpp1y/pr79937-3.C: New test.
* g++.dg/cpp1y/pr79937-4.C: New test.
* g++.dg/cpp1y/pr82410.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258593 138bc75d-0d04-0410-961f-82ee72b054a4
15 files changed:
gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-gimplify.c
gcc/cp/cp-tree.h
gcc/cp/tree.c
gcc/cp/typeck2.c
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr79937-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/pr79937-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/pr79937-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/pr79937-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/pr82410.C [new file with mode: 0644]
gcc/tree.h