https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87950
nightstrike <nightstrike at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nightstrike at gmail dot com
--- Comment #17 from nightstrike <nightstrike at gmail dot com> ---
(In reply to Arsen Arsenović from comment #16)
> can't we assume that following the aforementioned
> https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1766 ? at
> least in C++>=17 (and, this bug should either be hijacked or remade for C++,
> probably)
As long as we are hijacking for C++, the following should not warn, given how
enum class works:
$ cat e.cc
enum class E {
A,
B,
};
char get(E e) {
switch (e) {
case E::A: return 'a';
case E::B: return 'b';
}
}
$ g++-14.1 -c e.cc
e.cc: In function 'char get(E)':
e.cc:11:1: warning: control reaches end of non-void function [-Wreturn-type]
11 | }
| ^