X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftcon%2Ftest%2Fcompile_fail-container2w.c;fp=ccan%2Ftcon%2Ftest%2Fcompile_fail-container2w.c;h=c73123cacd2c8639e88cfda48591c515fb0f3276;hb=0ddea4131eca28437638cdaf9394324fafab33da;hp=0000000000000000000000000000000000000000;hpb=fd48aee6393bda1e4eda9f9e52e6d9f818b77211;p=ccan diff --git a/ccan/tcon/test/compile_fail-container2w.c b/ccan/tcon/test/compile_fail-container2w.c new file mode 100644 index 00000000..c73123ca --- /dev/null +++ b/ccan/tcon/test/compile_fail-container2w.c @@ -0,0 +1,35 @@ +#include + +#include +#include +#include + +struct inner { + int inner_val; +}; + +struct outer { + int outer_val; + struct inner inner; +}; + +struct info_base { + char *infop; +}; + +int main(int argc, char *argv[]) +{ + TCON_WRAP(struct info_base, + TCON_CONTAINER(concan, struct outer, inner)) info; + struct outer ovar; +#ifdef FAIL +#if !HAVE_TYPEOF +#error We cannot detect type problems without HAVE_TYPEOF +#endif + char *outerp = NULL; +#else + struct outer *outerp = &ovar; +#endif + + return tcon_member_of(&info, concan, outerp) == &ovar.inner; +}