Dear gcc developers,

 I have found a weird discrepancy in error/warning reporting in
GCC4.x. The following fragment:

enum e { A, B, C };
struct u { enum e e:2; };
void bar(struct u u) {
       switch (u.e) {
       case A:;
       }
}

 It does (rightfully) trigger a -Wswitch warning on gcc-3.3 and
gcc-3.4 but not on gcc-4.x.

 Note that the presence of the bitwidth specifier is essential for
this bug. My estimate is that the specifier makes the field to lose
its enum typedness, preventing further passes to from recognising
this (rather important) error.

 This is a bit weird, since giving the specifier a value that does
not match the range of the enum (e.g., :1) does trigger a warning
(`e' is narrower than values of its type).

  I am using Debian-packaged compilers.

Regards,

Pjotr Kourzanov


Reply via email to