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 <iain@sandoe.co.uk>
(cherry picked from commit ab3f04b73e5a1dd734d3bab64b4878d2d0cc29ad)
2 files changed