blob: 472da6a4190761ed28e5842e0cc85b422421d9b5 [file] [log] [blame]
// credit goes to Martin Uecker for the awesome ICE_P macro
#define ICE_P(x) \
(__builtin_types_compatible_p(typeof(0?((void*)((long)(x)*0l)):(int*)1),int*))
#define T(x) __builtin_choose_expr(ICE_P(x), 1, 0)
#define TEST(x, r) _Static_assert(T(x) == r, #x " => " #r)
static void test(int n)
{
char foo[n++];
TEST(sizeof(foo), 0);
}
/*
* check-name: vla-sizeof-ice
* check-command: sparse -Wno-vla $file
*/