lib: import ccan modules for tdb2
[samba.git] / lib / ccan / typesafe_cb / test / compile_fail-typesafe_cb_cast.c
1 #include <ccan/typesafe_cb/typesafe_cb.h>
2
3 void _set_some_value(void *val);
4
5 void _set_some_value(void *val)
6 {
7 }
8
9 #define set_some_value(expr)                                            \
10         _set_some_value(typesafe_cb_cast(void *, unsigned long, (expr)))
11
12 int main(int argc, char *argv[])
13 {
14 #ifdef FAIL
15         int x = 0;
16         set_some_value(x);
17 #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
18 #error "Unfortunately we don't fail if typesafe_cb_cast is a noop."
19 #endif
20 #else
21         void *p = 0;
22         set_some_value(p);
23 #endif
24         return 0;
25 }