]> git.ozlabs.org Git - ccan/blob - ccan/tcon/test/compile_fail-tcon_cast_wrap.c
tcon: Encode information on container members in "type" canaries
[ccan] / ccan / tcon / test / compile_fail-tcon_cast_wrap.c
1 #include <ccan/tcon/tcon.h>
2 #include <stdlib.h>
3
4 struct container {
5         void *p;
6 };
7
8 int main(int argc, char *argv[])
9 {
10         TCON_WRAP(struct container,
11                   int *tc1; char *tc2) icon;
12 #ifdef FAIL
13 #if !HAVE_TYPEOF
14 #error We cannot detect type problems without HAVE_TYPEOF
15 #endif
16         char *
17 #else
18         int *
19 #endif
20                 x;
21
22         tcon_unwrap(&icon)->p = NULL;
23         x = tcon_cast(&icon, tc1, tcon_unwrap(&icon)->p);
24         return x != NULL ? 0 : 1;
25 }