https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951

--- Comment #11 from Askar Safin <safinaskar at mail dot ru> ---
(In reply to Jonathan Wakely from comment #10)
> I wish people would just learn how enums work, it's not that complicated.

Okey, now I understand everything. Now I see that, well, -fstrict-enums
silences warning for code from comment #1 only because number of enum
alternatives happen to be power of 2. If it would be, say, 3, then code from
comment #1 will always produce a warning even with -fstrict-enums. And also I
understand that code with "enum class" will always produce a warning.

So, gcc doesn't have way to enable clang-style warning behavior for enums. And
gcc doesn't have such way for "enum class", too. And -fstrict-enums enables
clang-style warning behavior for code from comment #1 only because this code
has power of 2 number of alternatives.

And also I understand that current gcc behavior is not bug and is absolutely
standard-compliant.

But, well, I still don't like current g++ behavior. I want g++ to not report
"reaching end of non-void..." if all switch alternatives are handled, at least
if some optional option is passed to gcc. I want clang behavior. Okey, you may
mark this bug as "wishlist", but I still think that clang-style behavior here
is very useful feature.

Look here, LLVM project was forced to introduce special kludge to make sure g++
will not give useless warnings:
http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations

Reply via email to