]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++, coroutines: Avoid UNKNOWN_LOCATION synthesizing code [PR120273].
authorIain Sandoe <iain@sandoe.co.uk>
Tue, 3 Jun 2025 12:07:27 +0000 (13:07 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 17 Jun 2025 05:10:45 +0000 (08:10 +0300)
commit3b95be7bd1882add4b1e22f6b70bc130cd465eca
tree5e10112b1e75bfae1f24f62418063844dba63e58
parent6a17361496afbef5a095b9d5f26642cc8465fa31
c++, coroutines: Avoid UNKNOWN_LOCATION synthesizing code [PR120273].

Some of the lookup code is expecting to find a valid (not UNKNOWN)
location, which triggers in the reported case.  To avoid this, we are
reverting the change to use UNKNOWN_LOCATION for synthesizing the
wrapper, and instead using the start and end locations of the original
function.

PR c++/120273

gcc/cp/ChangeLog:

* coroutines.cc
(cp_coroutine_transform::wrap_original_function_body): Use
function start and end locations when synthesizing code.
(cp_coroutine_transform::cp_coroutine_transform): Set the
function end location.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr120273.C: New test.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/pr120273.C [new file with mode: 0644]