db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / validation / constexpr-offsetof.c
blobf55cb5639b16eac82f88f9ceccb624b6db809b57
1 struct A {
2 int a[1];
3 int b;
4 };
6 extern int c;
8 static int o[] = {
9 [__builtin_offsetof(struct A, b)] = 0, // OK
10 [__builtin_offsetof(struct A, a[0])] = 0, // OK
11 [__builtin_offsetof(struct A, a[0*0])] = 0, // OK
12 [__builtin_offsetof(struct A, a[c])] = 0 // KO
16 * check-name: constexprness __builtin_offsetof()
18 * check-error-start
19 constexpr-offsetof.c:12:39: error: bad constant expression
20 * check-error-end