diff options
| author | Nathaniel Shead <nathanieloshead@gmail.com> | 2026-01-24 19:34:53 +1100 |
|---|---|---|
| committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2026-01-31 20:42:43 +1100 |
| commit | 6bfec5d7b8b87f505d974da8e24240af11b9914e (patch) | |
| tree | b330ead8bebe09ca556e001ff056ed8bfe3aff53 /libjava/classpath/java | |
| parent | d6386e0984556173339c06b2b7cfe2dd55eeb07b (diff) | |
| download | gcc-6bfec5d7b8b87f505d974da8e24240af11b9914e.zip gcc-6bfec5d7b8b87f505d974da8e24240af11b9914e.tar.gz gcc-6bfec5d7b8b87f505d974da8e24240af11b9914e.tar.bz2 | |
c++: Fix cp_fold_non_odr_use_1 [PR123557,PR123738]
This fixes two issues with cp_fold_non_odr_use_1:
- When called to fold away a reference, it considers the use to not be
an lvalue and so 'maybe_constant_value' folds all the way through the
nested INDIRECT_REF to a prvalue. Fixed by folding the op0 of the
INDIRECT_REF rather than the ref itself and avoiding a double
cp_fold_non_odr_use_1.
- When used to fold away the initializing expression for an INIT_EXPR,
it doesn't mark any new TARGET_EXPRs as eliding. Fixed by reapplying
'set_target_expr_eliding' for the initializer of an INIT_EXPR if it
got modified during ff_only_non_odr walk.
PR c++/123557
PR c++/123738
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_fold_maybe_rvalue): Call
cp_fold_non_odr_use_1 before recursing cp_fold.
(cp_fold): Pass op0 to cp_fold_non_odr_use_1 when folding a
reference. Reapply set_target_expr_eliding on the initializing
expression of an INIT_EXPR.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-ice22.C: New test.
* g++.dg/cpp2a/constexpr-ref2.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'libjava/classpath/java')
0 files changed, 0 insertions, 0 deletions
