]> git.ozlabs.org Git - ccan/blob - ccan/cast/test/compile_fail-cast_const3.c
endian: add constant versions.
[ccan] / ccan / cast / test / compile_fail-cast_const3.c
1 #include <ccan/cast/cast.h>
2 #include <stdlib.h>
3
4 /* Note: this *isn't* sizeof(char) on all platforms. */
5 struct char_struct {
6         char c;
7 };
8
9 int main(int argc, char *argv[])
10 {
11         char ***uc;
12         const
13 #ifdef FAIL
14                 struct char_struct
15 #else
16                 char
17 #endif
18                 ***p = NULL;
19
20         uc = cast_const3(char ***, p);
21         (void) uc; /* Suppress unused-but-set-variable warning. */
22         return 0;
23 }
24
25 #ifdef FAIL
26 #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
27 #error "Unfortunately we don't fail if cast_const can only use size"
28 #endif
29 #endif