[Bug c/42439] Linux kernel BUILD_BUG_ON() broke
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Sun Dec 20 01:16:00 GMT 2009
------- Comment #2 from joseph at codesourcery dot com 2009-12-20 01:16 -------
Subject: Re: New: Linux kernel BUILD_BUG_ON() broke
This is a different sort of not-an-integer-constant-expression from the
previous cases the kernel was found to use with invalid unevaluated
operands (I asked in <http://gcc.gnu.org/ml/gcc/2009-04/msg00678.html> if
it was being used for bit-field widths).
const int max = [valid expression];
((void)(sizeof(struct { int:-!!(max >= (1 << 16)); })));
Here, you are using a const variable in what's meant to be an integer
constant expression, which is only valid for C++ not C. Much the same
workaround as applied for enums in
<http://gcc.gnu.org/ml/gcc-patches/2009-04/msg02022.html> would probably
work for this, but it's clearly a different undocumented extension being
used.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42439
More information about the Gcc-bugs
mailing list