On 10/10/2010 02:15 PM, Bruno Haible wrote: > I disagree that this is enough. The C standard says that a cast to floating- > point types cannot be portably used in integer constant expressions. But a > compiler is free to support this, as an extension.
By the same argument, a compiler is also free to support struct foo { unsigned int bar : -1 }; as an extension, and therefore none of gnulib's verification code can possibly work. Which obviously is not the case. The C Standard requires a diagnostic for the above declaration, because the "-1" violates a constraint. Similarly, the C Standard requires a diagnostic if we replace "-1" with "1.0", because the requirement that the bitfield width must be an integral constant expression is a constraint, and constraint violations must be diagnosed. If there were a popular nonstandard compiler that accepted these declarations without complaint, then we'd be in trouble. But fortunately for us, that's not the case.