This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/53524] [4.7/4.8 Regression] Bogus and unsuppressible enum comparison warning


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53524

--- Comment #8 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2012-05-30 16:29:08 UTC ---
(In reply to comment #6)
> The warnings are an unintended effect of my fix for PR16603.

So, before your fix, same_type_p was returning true? 

enum { e1 = -1 };
enum { e2 = -1 };

int j;
void foo(void) {
  j = 0 ? e1 : e2;
}

g++ 4.3.2
tt.cc:6: warning: enumeral mismatch in conditional expression: â<anonymous
enum>â vs â<anonymous enum>â

So, the warning is intended, and the fact that we did not warn before was a
bug. However, it is not clear to me how this code can be dangerous. But the
warning is very very old.

r29056 | nathan | 1999-09-02 11:21:42 +0200 (Thu, 02 Sep 1999) | 4 lines

        * call.c (build_conditional_expr): Warn on enum mismatches.
        (convert_arg_to_ellipsis): Move non-pod check to after
        conversion.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]