[Bug c++/109323] New: No error when neither of return_value or return_void is defined
enricomaria.dean6elis at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Mar 28 21:52:04 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109323
Bug ID: 109323
Summary: No error when neither of return_value or return_void
is defined
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: enricomaria.dean6elis at gmail dot com
Target Milestone: ---
Repro:
1. take the example here ->
https://en.cppreference.com/w/cpp/language/coroutines
2. remove the 3 `if (cond) co_return;` from `fibonacci_sequence`
3. remove `return_void` from `promise_type`
4. compile
Alternatively: https://godbolt.org/z/v3xd3b7TE, where both GCC and Clang
erroneously accept the code, whereas MSVC correcly rejects it.
(http://eel.is/c++draft/dcl.fct.def.coroutine#6)
I'm aware of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95517, but that makes
no reference to the fact that not declaring any of the two functions is
erroneous.
More information about the Gcc-bugs
mailing list