]> git.ozlabs.org Git - ccan/blobdiff - ccan/tcon/test/compile_fail-wrap.c
tcon: Add an alternate way of building type canaries
[ccan] / ccan / tcon / test / compile_fail-wrap.c
diff --git a/ccan/tcon/test/compile_fail-wrap.c b/ccan/tcon/test/compile_fail-wrap.c
new file mode 100644 (file)
index 0000000..26da13c
--- /dev/null
@@ -0,0 +1,20 @@
+#include <ccan/tcon/tcon.h>
+#include <stdlib.h>
+
+struct container {
+       void *p;
+};
+
+int main(int argc, char *argv[])
+{
+       TCON_WRAP(struct container, int *canary) icon;
+#ifdef FAIL
+       char *
+#else
+       int *
+#endif
+               x = NULL;
+
+       tcon_unwrap(tcon_check(&icon, canary, x))->p = x;
+       return 0;
+}