coroutines : Adjust error handling for type-dependent coroutines [PR96251].
authorIain Sandoe <iain@sandoe.co.uk>
Tue, 23 Feb 2021 12:54:26 +0000 (12:54 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Wed, 24 Feb 2021 11:57:17 +0000 (11:57 +0000)
commitf13d9e48eeca7ed8f8df55c9a62fc9980d5606ad
tree8893d1f6baef63f73fa712887f2d8f185fecd827
parent6e646abbe02f2c79cc3ba1f3de705ee62ff9dcd1
coroutines : Adjust error handling for type-dependent coroutines [PR96251].

Although coroutines are not permitted to be constexpr, generic lambdas
are implicitly from C++17 and, because of this, a generic coroutine lambda
can be marked as potentially constexpr. As per the PR, this then fails when
type substitution is attempted because the check disallowing constexpr in
the coroutines code was overly restrictive.

This changes the error handing to mark the function  as 'invalid_constexpr'
but suppresses the error in the case that we are instantiating a constexpr.

gcc/cp/ChangeLog:

PR c++/96251
* coroutines.cc (coro_common_keyword_context_valid_p): Suppress
error reporting when instantiating for a constexpr.

gcc/testsuite/ChangeLog:

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