summaryrefslogtreecommitdiff
path: root/lib/ccan/tcon/test/compile_fail.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ccan/tcon/test/compile_fail.c')
-rw-r--r--lib/ccan/tcon/test/compile_fail.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/ccan/tcon/test/compile_fail.c b/lib/ccan/tcon/test/compile_fail.c
new file mode 100644
index 0000000000..683bbd62ff
--- /dev/null
+++ b/lib/ccan/tcon/test/compile_fail.c
@@ -0,0 +1,25 @@
+#include <ccan/tcon/tcon.h>
+#include <stdlib.h>
+
+struct container {
+ void *p;
+};
+
+struct int_container {
+ struct container raw;
+ TCON(int *canary);
+};
+
+int main(int argc, char *argv[])
+{
+ struct int_container icon;
+#ifdef FAIL
+ char *
+#else
+ int *
+#endif
+ x = NULL;
+
+ tcon_check(&icon, canary, x)->raw.p = x;
+ return 0;
+}