Merge Makefile rewrite into master
[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         (void)any;
27 }
28
29 int main(void)
30 {
31 #ifdef FAIL
32         struct other
33 #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
34 #error "Unfortunately we don't fail if typesafe_cb_cast is a noop."
35 #endif
36 #else
37         struct foo
38 #endif
39                 *arg = NULL;
40         take_any(typesafe_cb_cast3(struct any *,
41                                    struct foo *, struct bar *, struct baz *,
42                                    arg));
43         return 0;
44 }