]> git.ozlabs.org Git - ccan/blob - ccan/typesafe_cb/test/compile_ok-cast_if_any.c
typesafe_cb: expose _exact and _def variants.
[ccan] / ccan / typesafe_cb / test / compile_ok-cast_if_any.c
1 #include <ccan/typesafe_cb/typesafe_cb.h>
2 #include <stdlib.h>
3
4 struct foo {
5         int x;
6 };
7
8 struct bar {
9         int x;
10 };
11
12 struct baz {
13         int x;
14 };
15
16 struct any {
17         int x;
18 };
19
20 static void take_any(struct any *any)
21 {
22 }
23
24 int main(int argc, char *argv[])
25 {
26         struct foo *foo = NULL;
27         struct bar *bar = NULL;
28         struct baz *baz = NULL;
29         struct other *arg = NULL;
30
31         take_any(cast_if_any(struct any *, arg, foo,
32                              struct foo *, struct bar *, struct baz *));
33         take_any(cast_if_any(struct any *, arg, bar,
34                              struct foo *, struct bar *, struct baz *));
35         take_any(cast_if_any(struct any *, arg, baz,
36                              struct foo *, struct bar *, struct baz *));
37         return 0;
38 }