struct a {unsigned b : 2;}; int foo (struct a *p) {return 2u < p->b + 1;} int bar (struct a *p) {return 2u < (unsigned)p->b + 1;} gcc -W -Wall gives bitfield.c:2: warning: comparison between signed and unsigned bitfield.c:3: warning: comparison between signed and unsigned 1) is it correct to promote an unsigned bitfield smaller than an int to signed int? (I think so, but am not 100% sure) 2) (unsigned)p->b + 1, should have unsigned type, hence the 2nd warning is spurious
This is a dup of bug 3325. *** This bug has been marked as a duplicate of 3325 ***