]> git.ozlabs.org Git - ccan/blob - ccan/typesafe_cb/test/compile_fail-typesafe_cb_cast-multi.c
62b5f91e1807cdaaebff2a0a0f95bd554388add5
[ccan] / ccan / typesafe_cb / test / compile_fail-typesafe_cb_cast-multi.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 struct other {
21         int x;
22 };
23
24 static void take_any(struct any *any)
25 {
26 }
27
28 int main(int argc, char *argv[])
29 {
30 #ifdef FAIL
31         struct other
32 #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
33 #error "Unfortunately we don't fail if typesafe_cb_cast is a noop."
34 #endif
35 #else
36         struct foo
37 #endif
38                 *arg = NULL;
39         take_any(typesafe_cb_cast3(struct any *,
40                                    struct foo *, struct bar *, struct baz *,
41                                    arg));
42         return 0;
43 }