[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #11 from Jason Merrill --- Fixed for 15.3/16.
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 --- Comment #10 from GCC Commits --- The releases/gcc-15 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:95fb3cdf169b49393e386a2b9042803d944dfe8e commit r15-11086-g95fb3cdf169b49393e386a2b9042803d944dfe8e Author: Jason Merrill Date: Tue Apr 14 19:19:37 2026 -0400 c++: unusual await_suspend parameters [PR123975] expand_one_await_expression was assuming we could replace the last argument of await_suspend with a call to handle::from_address. This is wrong if either the handle parameter has a different type (123975) or await_suspend has additional parameters (121643). PR c++/121643 PR c++/123975 gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Pass rvalue to await_suspend. (expand_one_await_expression): Fix await_suspend surgery. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr121643.C: New test. * g++.dg/coroutines/pr123975.C: New test. (cherry picked from commit 3bf1ba4c723b8fd6274fb134890c83031d00d408)
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 --- Comment #9 from GCC Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:3bf1ba4c723b8fd6274fb134890c83031d00d408 commit r16-8676-g3bf1ba4c723b8fd6274fb134890c83031d00d408 Author: Jason Merrill Date: Tue Apr 14 19:19:37 2026 -0400 c++: unusual await_suspend parameters [PR123975] expand_one_await_expression was assuming we could replace the last argument of await_suspend with a call to handle::from_address. This is wrong if either the handle parameter has a different type (123975) or await_suspend has additional parameters (121643). The change to pr105287.C is needed because that test now correctly calls operator coroutine_handle<>(), and that addition confuses the analyzer into thinking there's a use-after-free problem. Since the analyzer is known to have a lot of trouble with coroutines (PR105382), let's ignore the new false positive and just check that the test doesn't ICE. PR c++/121643 PR c++/123975 gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Pass rvalue to await_suspend. (expand_one_await_expression): Fix await_suspend surgery. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr105287.C: Add dg-excess-errors. * g++.dg/coroutines/pr121643.C: New test. * g++.dg/coroutines/pr123975.C: New test.
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Jason Merrill changed: What|Removed |Added CC||jason at gcc dot gnu.org Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Drea Pinski changed: What|Removed |Added CC||n.d.chernyshev at hotmail dot com --- Comment #8 from Drea Pinski --- *** Bug 124092 has been marked as a duplicate of this bug. ***
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 --- Comment #7 from Danijel Zlaus --- (In reply to Danijel Zlaus from comment #3) > Just hit this bug when bumping up GCC from 15.1 to 15.2. > > https://godbolt.org/z/fdsc69PzY > > The issue appears to be the same. That is, await_suspend of the Awaiter > takes a default parameter (const boost::source_location & loc = > BOOST_CURRENT_LOCATION). Wrong link, my mistake, was testing the attached example and messed up copy/pasting somehow. The bug was hit when using Boost.Cobalt with one of its Awaitables. https://godbolt.org/z/s9c4e7Y9b (In reply to Iain Sandoe from comment #5) > (In reply to Patrick Palka from comment #4) > > Started with r16-1548 / r15-10103-ga169a4718b5b62 > > interesting ... > > https://eel.is/c++draft/expr.await#3.7 > > does not appear to give the option for additional parameters to > await_suspend() > > ... are we sure that it is intended? Probably is, as the same argument applies to 3.6 (await-ready) and 3.8 (await-resume), but you can currently have default arguments on both. See https://godbolt.org/z/8KWGjsj39 My lay interpretation is that the wording only constrains how the call should be made, but says nothing about any additional defaulted arguments those functions may have in their declaration.
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 --- Comment #6 from Iain Sandoe --- (In reply to Iain Sandoe from comment #5) > (In reply to Patrick Palka from comment #4) > > Started with r16-1548 / r15-10103-ga169a4718b5b62 > > interesting ... > > https://eel.is/c++draft/expr.await#3.7 > > does not appear to give the option for additional parameters to > await_suspend() > > ... are we sure that it is intended? (of course, we should not ICE in any case)
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 --- Comment #5 from Iain Sandoe --- (In reply to Patrick Palka from comment #4) > Started with r16-1548 / r15-10103-ga169a4718b5b62 interesting ... https://eel.is/c++draft/expr.await#3.7 does not appear to give the option for additional parameters to await_suspend() ... are we sure that it is intended?
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Patrick Palka changed: What|Removed |Added CC||iains at gcc dot gnu.org, ||ppalka at gcc dot gnu.org --- Comment #4 from Patrick Palka --- Started with r16-1548 / r15-10103-ga169a4718b5b62
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Danijel Zlaus changed: What|Removed |Added CC||danijel.zlaus at gmail dot com --- Comment #3 from Danijel Zlaus --- Just hit this bug when bumping up GCC from 15.1 to 15.2. https://godbolt.org/z/fdsc69PzY The issue appears to be the same. That is, await_suspend of the Awaiter takes a default parameter (const boost::source_location & loc = BOOST_CURRENT_LOCATION).
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Richard Biener changed: What|Removed |Added Priority|P3 |P2
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2025-08-23 Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski --- Confirmed. -std=c++20 is enough for my example.
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Andrew Pinski changed: What|Removed |Added Attachment #62176|0 |1 is obsolete|| --- Comment #1 from Andrew Pinski --- Created attachment 62177 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62177&action=edit Shorter example
[Bug c++/121643] [15/16 Regression] Internal compiler error when await_suspend takes default argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121643 Andrew Pinski changed: What|Removed |Added Known to fail||15.2.0 Summary|Internal compiler error |[15/16 Regression] Internal |when await_suspend takes|compiler error when |default argument|await_suspend takes default ||argument Known to work||15.1.0 Target Milestone|--- |15.3
