tdb2: fix msync() arg
[ccan] / ccan / cast / test / compile_fail-cast_const2.c
index 88df4b7a853168141dd3e07fb2bf045fe41c9874..a16cfacf15354c468189d50a4a87d6550da30442 100644 (file)
@@ -1,12 +1,17 @@
 #include <ccan/cast/cast.h>
 #include <stdlib.h>
 
+/* Note: this *isn't* sizeof(char) on all platforms. */
+struct char_struct {
+       char c;
+};
+
 int main(int argc, char *argv[])
 {
        char **uc;
-       const 
+       const
 #ifdef FAIL
-               int
+               struct char_struct
 #else
                char
 #endif
@@ -15,3 +20,9 @@ int main(int argc, char *argv[])
        uc = cast_const2(char **, p);
        return 0;
 }
+
+#ifdef FAIL
+#if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
+#error "Unfortunately we don't fail if cast_const can only use size"
+#endif
+#endif