This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled
- From: "vlovich at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Nov 2018 19:57:53 +0000
- Subject: [Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled
- Auto-submitted: auto-generated
- References: <bug-87951-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951
--- Comment #5 from Vitali <vlovich at gmail dot com> ---
Jonathan, I think the defect report here does actually apply to this example. I
agree the argument could be made that if there's gaps in the enum values that
it's arguable that the current GCC behaviour is standards compliant (clearly
clang & GCC disagree on this for both C & C++ so unclear who's right or wrong
in their interpretation of what's allowed).
However, in the example posted this is a "dense" enum. There's no integer value
possible that's not outside the range & yet GCC still continues to treat that
as a possibility & thus missing optimization opportunities & generating
false-positive warnings.