This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]