X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftypesafe_cb%2Ftest%2Fcompile_ok-cast_if_any.c;fp=ccan%2Ftypesafe_cb%2Ftest%2Fcompile_ok-cast_if_any.c;h=2955f60c93efb7ca29ef174b7f46203bd61f61f7;hp=0000000000000000000000000000000000000000;hb=175ca4aa64c3489011b441a8c709693af1e70db0;hpb=67a035869c6f3512ba943ae197b407f182a4506d diff --git a/ccan/typesafe_cb/test/compile_ok-cast_if_any.c b/ccan/typesafe_cb/test/compile_ok-cast_if_any.c new file mode 100644 index 00000000..2955f60c --- /dev/null +++ b/ccan/typesafe_cb/test/compile_ok-cast_if_any.c @@ -0,0 +1,38 @@ +#include +#include + +struct foo { + int x; +}; + +struct bar { + int x; +}; + +struct baz { + int x; +}; + +struct any { + int x; +}; + +static void take_any(struct any *any) +{ +} + +int main(int argc, char *argv[]) +{ + struct foo *foo = NULL; + struct bar *bar = NULL; + struct baz *baz = NULL; + struct other *arg = NULL; + + take_any(cast_if_any(struct any *, arg, foo, + struct foo *, struct bar *, struct baz *)); + take_any(cast_if_any(struct any *, arg, bar, + struct foo *, struct bar *, struct baz *)); + take_any(cast_if_any(struct any *, arg, baz, + struct foo *, struct bar *, struct baz *)); + return 0; +}