[Bug c++/85714] -Wimplicit-fallthrough and nested exhaustive switch statements with enum classes and return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714 --- Comment #7 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #5) > The enumeration type can take any value from (Foo)INT_MIN to (Foo)INT_MAX, > and likewise for Bar. Your switches are not exhaustive. > > I think we need a FAQ about this, we have so many invalid bug reports like > this. https://gcc.gnu.org/wiki/VerboseDiagnostics#enum_switch
[Bug c++/85714] -Wimplicit-fallthrough and nested exhaustive switch statements with enum classes and return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714 Andrew Pinski changed: What|Removed |Added CC||maic23 at live dot de --- Comment #6 from Andrew Pinski --- *** Bug 90300 has been marked as a duplicate of this bug. ***
[Bug c++/85714] -Wimplicit-fallthrough and nested exhaustive switch statements with enum classes and return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #5 from Jonathan Wakely --- The enumeration type can take any value from (Foo)INT_MIN to (Foo)INT_MAX, and likewise for Bar. Your switches are not exhaustive. I think we need a FAQ about this, we have so many invalid bug reports like this.
[Bug c++/85714] -Wimplicit-fallthrough and nested exhaustive switch statements with enum classes and return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714 --- Comment #4 from TC --- [dcl.enum]p4: The underlying type can be explicitly specified using an enum-base. For a scoped enumeration type, the underlying type is int if it is not explicitly specified. In both of these cases, the underlying type is said to be fixed. p8: For an enumeration whose underlying type is fixed, the values of the enumeration are the values of the underlying type.
[Bug c++/85714] -Wimplicit-fallthrough and nested exhaustive switch statements with enum classes and return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714 --- Comment #3 from Thomas Otto--- I thought forcing out-of-range enum values is no longer unspecified but now undefined behavior in C++17: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1766 http://obiwahn.org/c++draft/expr.static.cast/#10 > The value is unchanged if the original value is within the range of the > enumeration values ([dcl.enum]). Otherwise, the behavior is undefined. And this warning also shows up with -std=c++17
[Bug c++/85714] -Wimplicit-fallthrough and nested exhaustive switch statements with enum classes and return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714 TC changed: What|Removed |Added CC||rs2740 at gmail dot com --- Comment #2 from TC --- A variable of scoped enumeration type can hold any value of its underlying type (int in this case) and is not limited to the value of the enumerators. The warning seems reasonable.
[Bug c++/85714] -Wimplicit-fallthrough and nested exhaustive switch statements with enum classes and return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714 --- Comment #1 from Thomas Otto--- Created attachment 44098 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44098=edit -Werror=implicit-fallthrough false positive demo