https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116775
--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>: https://gcc.gnu.org/g:ab3f04b73e5a1dd734d3bab64b4878d2d0cc29ad commit r16-1508-gab3f04b73e5a1dd734d3bab64b4878d2d0cc29ad Author: Iain Sandoe <i...@sandoe.co.uk> Date: Mon Jun 9 11:00:47 2025 +0100 c++, coroutines: Handle builtin_constant_p [PR116775]. Since the folding of this builtin happens after the main coroutine FE lowering, we need to account for await expressions in that lowering. Since these expressions have a property of being not evaluated, but do not have the full constraints of an unevaluatated context, we want to apply the checks and then remove the await expressions so that they no longer participate in the analysis and lowering. When a builtin_constant_p call is encountered, and the operand contains any await expression, we check to see if the operand can be a constant and replace the call with its result. PR c++/116775 gcc/cp/ChangeLog: * coroutines.cc (analyze_expression_awaits): When we see a builtin_constant_p call, and that contains one or more await expressions, then replace the call with its result and discard the unevaluated operand. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr116775.C: New test. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>