public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109867] New: -Wswicht-default reports missing default in coroutine
@ 2023-05-15 21:44 lukaslang.bugtracker at outlook dot com
2024-01-30 14:04 ` [Bug c++/109867] -Wswitch-default " piotrwn1 at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: lukaslang.bugtracker at outlook dot com @ 2023-05-15 21:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109867
Bug ID: 109867
Summary: -Wswicht-default reports missing default in coroutine
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lukaslang.bugtracker at outlook dot com
Target Milestone: ---
Consider the following implementation of a simple coroutine
(https://godbolt.org/z/rcevTd5f6):
#include <coroutine>
struct task
{
struct promise_type
{
std::suspend_always initial_suspend();
std::suspend_always final_suspend() noexcept;
void unhandled_exception();
task get_return_object();
void return_value(int);
};
};
int main()
{
auto t = []() -> task
{
co_return 2;
}();
}
Compiling this with -std=c++20 -Wswitch-default -Werror results in an error at
the end of the coroutine body:
<source>:20:5: error: switch missing default case [-Werror=switch-default]
20 | }();
Since I can get neither clang nor msvc to complain, I assume this is a bug, or
am I missing something? If this is indeed a bug, can I work around this without
having to disable the warning?
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/109867] -Wswitch-default reports missing default in coroutine
2023-05-15 21:44 [Bug c++/109867] New: -Wswicht-default reports missing default in coroutine lukaslang.bugtracker at outlook dot com
@ 2024-01-30 14:04 ` piotrwn1 at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: piotrwn1 at gmail dot com @ 2024-01-30 14:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109867
Piotr Nycz <piotrwn1 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |piotrwn1 at gmail dot com
--- Comment #1 from Piotr Nycz <piotrwn1 at gmail dot com> ---
This also happens for void coroutine (return_void()).
Quite big annoying
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-30 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15 21:44 [Bug c++/109867] New: -Wswicht-default reports missing default in coroutine lukaslang.bugtracker at outlook dot com
2024-01-30 14:04 ` [Bug c++/109867] -Wswitch-default " piotrwn1 at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).