]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: change implementation of -frange-for-ext-temps [PR118574]
authorJason Merrill <jason@redhat.com>
Mon, 10 Feb 2025 14:44:13 +0000 (15:44 +0100)
committerJason Merrill <jason@redhat.com>
Tue, 11 Feb 2025 22:46:13 +0000 (23:46 +0100)
commit0d2a5f3cb715fd95f1fa4a13b5d67c7eea28f178
treea58af1e28cd714da3422ee91877fc32a5e7a796d
parent299a8e2dc667e795991bc439d2cad5ea5bd379e2
c++: change implementation of -frange-for-ext-temps [PR118574]

The implementation in r15-3840 used a novel technique of wrapping the entire
range-for loop in a CLEANUP_POINT_EXPR, which confused the coroutines
transformation.  Instead let's use the existing extend_ref_init_temps
mechanism.

This does not revert all of r15-3840, only the parts that change how
CLEANUP_POINT_EXPRs are applied to range-for declarations.

PR c++/118574
PR c++/107637

gcc/cp/ChangeLog:

* call.cc (struct extend_temps_data): New.
(extend_temps_r, extend_all_temps): New.
(set_up_extended_ref_temp): Handle tree walk case.
(extend_ref_init_temps): Cal extend_all_temps.
* decl.cc (initialize_local_var): Revert ext-temps change.
* parser.cc (cp_convert_range_for): Likewise.
(cp_parser_omp_loop_nest): Likewise.
* pt.cc (tsubst_stmt): Likewise.
* semantics.cc (finish_for_stmt): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/range-for1.C: New test.
gcc/cp/call.cc
gcc/cp/decl.cc
gcc/cp/parser.cc
gcc/cp/pt.cc
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/coroutines/range-for1.C [new file with mode: 0644]