1 #include <ccan/container_of/container_of.h>
2 #include <stdlib.h>
3 
4 struct foo {
5 	int a;
6 	char b;
7 };
8 
main(void)9 int main(void)
10 {
11 	struct foo foo = { .a = 1, .b = 2 }, *foop;
12 	int *intp = &foo.a;
13 
14 #ifdef FAIL
15 	/* b is a char, but intp is an int * */
16 	foop = container_of_var(intp, foop, b);
17 #if !HAVE_TYPEOF
18 #error "Unfortunately we don't fail if we don't have typeof."
19 #endif
20 #else
21 	foop = NULL;
22 #endif
23 	(void) foop; /* Suppress unused-but-set-variable warning. */
24 	return intp == NULL;
25 }
26