http://bugs.winehq.org/show_bug.cgi?id=25945
Summary: C_ASSERT doesn't fail if given non-constant expression Product: Wine Version: 1.1.22 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: alexander.scott.johns+winebug@googlemail.com
In commit wine-1.1.21-63-g5d31eb9 AJ changed the definition of C_ASSERT (in include/winnt.h) to make it compatible with newer versions of GCC.
Roughly, the change was:
-#define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1] __attribute__((unused)) +#define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
Unfortunately, in GCC 4.4.3, the new definition of C_ASSERT doesn't fail when given a non-constant expression. E.g.:
C_ASSERT(rand() == -1); /* ignored */
I think this is because GCC (as per C99) is treating the parameter of __C_ASSERT__ as a VLA (variable length array), and so its type is equivalent to int[*].