------- Comment #6 from ian at airs dot com 2009-05-25 18:32 ------- With unscoped enums the similar code works because cp_build_binary_op applies the default integral promotions to the enums, and winds up comparing two int values. The promotions are not applied to scoped enums because default_conversion checks INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P. I would guess that this would work if several checks in cp_build_binary_op also checked for ENUMERAL_TYPE in cases where they currently check for INTEGER_TYPE. But I haven't tried to read the standard to understand where the right fix is.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064