coroutines: Prevent repeated error messages for missing promise.
authorIain Sandoe <iain@sandoe.co.uk>
Tue, 4 Feb 2020 09:36:30 +0000 (09:36 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 4 Feb 2020 09:37:18 +0000 (09:37 +0000)
commit5bc9d2f5ed4c39a7cad74db34e2bb125e012fa60
tree037d790615997f3e62038b01203bec37b3b772a6
parent5f0653a8b75a5ad5a5405a27dd92d3a5759eed4c
coroutines: Prevent repeated error messages for missing promise.

If the user's coroutine return type omits the mandatory promise
type then we will currently restate that error each time we see
a coroutine keyword, which doesn't provide any new information.
This suppresses all but the first instance in each coroutine.

gcc/cp/ChangeLog:

2020-02-04  Iain Sandoe  <iain@sandoe.co.uk>

* coroutines.cc (find_promise_type): Delete unused forward
declaration.
(struct coroutine_info): Add a bool for no promise type error.
(coro_promise_type_found_p): Only emit the error for a missing
promise once in each affected coroutine.

gcc/testsuite/ChangeLog:

2020-02-04  Iain Sandoe  <iain@sandoe.co.uk>

* g++.dg/coroutines/coro-missing-promise.C: New test.
gcc/cp/ChangeLog
gcc/cp/coroutines.cc
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/coroutines/coro-missing-promise.C [new file with mode: 0644]