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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=61864

--- Comment #15 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Askar Safin from comment #11)
> (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

For the warning clang uses mentioned in the link (-Wcovered-switch-default) see
bug 61864. (It looks like the behavior to respect unreachables has been updated
since the last time I checked it)

Reply via email to