This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53524] [4.7/4.8 Regression] Bogus and unsuppressible enum comparison warning
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 May 2012 17:43:38 +0000
- Subject: [Bug c++/53524] [4.7/4.8 Regression] Bogus and unsuppressible enum comparison warning
- Auto-submitted: auto-generated
- References: <bug-53524-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53524
--- Comment #12 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2012-05-30 17:43:38 UTC ---
(In reply to comment #9)
> I think there is a largely linguistic misunderstanding: when I said unintended
> I meant that I did not *anticipate* that after my patch, which was fixing a
> real bug, we would end up warning more, in templates too. For sure the testcase
> I mentioned in my last message pre existed and likewise the code I posted here.
> In my opinion the warning, by itself, definitely makes sense in general, but it
> looks like, we may not want it uncinditionally, we may want to control it,
> otherwise can be annoying in the template contexts mentioned here. Do you agree
> with my summary? In practice: shall we give the warning a name and a switch?
Well, personally I think all warnings should have a switch, -Wenum-mismatch ?
But I don't see why the fact that it is triggered within a template makes a
difference:
enum { e1 };
enum { e2 };
enum {
a1 = e1,
a2 = e2,
a3 = 0 ? a1 : a2,
a4 = 0 ? e1 : e2,
};
int j;
void foo(void) {
j = a3;
}
I think what we don't want to warn for a3 but we want to warn for a4 because we
assume that a1 and a2 have the same type (despite the standard seems to say
that they don't until the closing brace) or we assume that the user does not
care.