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++/52763] Warning if compare between enum and non-enum type


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

--- Comment #3 from Mikka <gccreports@gmx-topmail.de> 2012-04-04 14:22:45 UTC ---
(In reply to comment #2)
> But what about cases such as (val1 == (ONE|TWO)) ?
> 
> (ONE|TWO) is of type 'int' but that code is correct and shouldn't warn

In my opinion, there should be a warning here, because (ONE|TWO) is not in the
enumeration range (there is no definition for 3).
If it was defined (e.g. typedef enum {NONE = 0, ONE = 1, TWO = 2, THREE = 3}
tEnumType), result could again be of the enumeration type and there would be no
warning.


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