]> git.ozlabs.org Git - ccan/blob - ccan/typesafe_cb/test/compile_fail-cast_if_any.c
ccanlint: print coverage amount when -vv
[ccan] / ccan / typesafe_cb / test / compile_fail-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 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 cast_if_type is a noop."
34 #endif
35 #else
36         struct foo
37 #endif
38                 *arg = NULL;
39         take_any(cast_if_any(struct any *, arg, arg,
40                              struct foo *, struct bar *, struct baz *));
41         return 0;
42 }