c++, coroutines: Account for overloaded promise return_value() [PR105301].
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 18 Apr 2022 08:21:52 +0000 (09:21 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 28 Apr 2022 12:52:23 +0000 (13:52 +0100)
commit6cae3bb65c873a2191613f7888fe949553a21f9e
tree57fc31ddc4712f710143fc12674510239e551fd2
parent15a176a833f23e64ad38690a678bf938227ce46f
c++, coroutines: Account for overloaded promise return_value() [PR105301].

Whether it was intended or not, it is possible to define a coroutine promise
with multiple return_value() methods [which need not even have the same type].

We were not accounting for this possibility in the check to see whether both
return_value and return_void are specifier (which is prohibited by the
standard).  Fixed thus and provided an adjusted diagnostic for the case that
multiple return_value() methods are present.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/105301

gcc/cp/ChangeLog:

* coroutines.cc (coro_promise_type_found_p): Account for possible
mutliple overloads of the promise return_value() method.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr105301.C: New test.
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/pr105301.C [new file with mode: 0644]