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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50398
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50398&action=edit
gcc11-pr99565.patch

If we don't want to warn in this case (I guess pedantically in both C and C++
it matters which exact union member is used even when it has the same type,
because only one of them can be active, but practically the compiler will treat
them the same anyway and so they are effectively the same), perhaps we could
revert Honza's change for OEP_LEXICOGRAPHIC and use that mode for the COND_EXPR
warnings (where previously it was used just for then/else variant).
But, apparently then we warn for some reason twice on:
int a;

void
foo (bool x)
{
  x ? ++a : ++a;
}
instead of once.  Or add some new OEP_ flag that would be used for
-Wduplicated-branches?

Reply via email to