X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftcon%2Ftest%2Fcompile_ok-container.c;fp=ccan%2Ftcon%2Ftest%2Fcompile_ok-container.c;h=9493c4dcc855ab9c375e445d1ea15605bf43407d;hb=cd2d09063cdfb0e730e7d3c344c85716d3217028;hp=0000000000000000000000000000000000000000;hpb=7a4e71c4180eaecc8799c050eeb052b0de8cf302;p=ccan diff --git a/ccan/tcon/test/compile_ok-container.c b/ccan/tcon/test/compile_ok-container.c new file mode 100644 index 00000000..9493c4dc --- /dev/null +++ b/ccan/tcon/test/compile_ok-container.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; +}; + +struct info_tcon { + struct info_base base; + TCON(TCON_CONTAINER(concan, struct outer, inner)); +}; + +int main(int argc, char *argv[]) +{ + /* Const should work! */ + const struct outer *ovar; + struct outer *o; + struct info_tcon info; + + o = tcon_container_of(&info, fi, &ovar->inner); + return (o == ovar); +} +