]> git.ozlabs.org Git - ccan/blob - ccan/tcon/test/compile_fail-tcon_cast.c
Merge Makefile rewrite into master
[ccan] / ccan / tcon / test / compile_fail-tcon_cast.c
1 #include <ccan/tcon/tcon.h>
2 #include <stdlib.h>
3
4 struct container {
5         void *p;
6 };
7
8 struct int_and_charp_container {
9         struct container raw;
10         TCON(int *tc1; char *tc2);
11 };
12
13 int main(void)
14 {
15         struct int_and_charp_container icon;
16 #ifdef FAIL
17 #if !HAVE_TYPEOF
18 #error We cannot detect type problems without HAVE_TYPEOF
19 #endif
20         char *
21 #else
22         int *
23 #endif
24                 x;
25
26         icon.raw.p = NULL;
27         x = tcon_cast(&icon, tc1, icon.raw.p);
28         return x != NULL ? 0 : 1;
29 }