First cut, some hacks, three simple modules.
[ccan] / container_of / test / compile_fail-types.c
1 #include "container_of/container_of.h"
2 #include <stdlib.h>
3
4 struct foo {
5         int a;
6         char b;
7 };
8
9 int main(int argc, char *argv[])
10 {
11         struct foo foo = { .a = 1, .b = 2 }, *foop;
12         int *intp = &foo.a;
13
14 #ifdef FAIL
15         foop = container_of(intp, struct foo, b);
16 #else
17         foop = NULL;
18 #endif
19         return intp == NULL;
20 }