[Bug c++/100879] [10/11/12 Regression] gcc is complaining of a signed compare when comparing enums of different types (same underlying type)

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 9 00:42:38 GMT 2021


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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:087253b9951766cbd93286b804ebb1ab59197aa8

commit r12-1314-g087253b9951766cbd93286b804ebb1ab59197aa8
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jun 8 17:48:49 2021 -0400

    c++: remove redundant warning [PR100879]

    Before my r277864, build_new_op promoted enums to int before passing them
on
    to cp_build_binary_op; after that commit, it doesn't, so
    warn_for_sign_compare sees the enum operands and gives a redundant warning.
    This warning dates back to 1995, and seems to have been dead code for a
long
    time--likely since build_new_op was added in 1997--so let's just remove it.

            PR c++/100879

    gcc/c-family/ChangeLog:

            * c-warn.c (warn_for_sign_compare): Remove C++ enum mismatch
            warning.

    gcc/testsuite/ChangeLog:

            * g++.dg/diagnostic/enum3.C: New test.


More information about the Gcc-bugs mailing list