X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftcon%2Ftest%2Fcompile_fail-tcon_cast_wrap.c;fp=ccan%2Ftcon%2Ftest%2Fcompile_fail-tcon_cast_wrap.c;h=f24cb01b8d791067a25b5f208a347172f4bf8b16;hp=0000000000000000000000000000000000000000;hb=43992de4769085b3aba0fd9c167a85ad14e771d2;hpb=fced03d35c9fdf132f4405114f8d507716da1842 diff --git a/ccan/tcon/test/compile_fail-tcon_cast_wrap.c b/ccan/tcon/test/compile_fail-tcon_cast_wrap.c new file mode 100644 index 00000000..f24cb01b --- /dev/null +++ b/ccan/tcon/test/compile_fail-tcon_cast_wrap.c @@ -0,0 +1,25 @@ +#include +#include + +struct container { + void *p; +}; + +int main(int argc, char *argv[]) +{ + TCON_WRAP(struct container, + int *tc1; char *tc2) icon; +#ifdef FAIL +#if !HAVE_TYPEOF +#error We cannot detect type problems without HAVE_TYPEOF +#endif + char * +#else + int * +#endif + x; + + tcon_unwrap(&icon)->p = NULL; + x = tcon_cast(&icon, tc1, tcon_unwrap(&icon)->p); + return x != NULL ? 0 : 1; +}