]> git.ozlabs.org Git - ccan/blobdiff - ccan/tcon/test/compile_ok-void.c
tcon: routines for creating typesafe generic containers
[ccan] / ccan / tcon / test / compile_ok-void.c
diff --git a/ccan/tcon/test/compile_ok-void.c b/ccan/tcon/test/compile_ok-void.c
new file mode 100644 (file)
index 0000000..26b712f
--- /dev/null
@@ -0,0 +1,21 @@
+#include <ccan/tcon/tcon.h>
+#include <stdlib.h>
+
+struct container {
+       void *p;
+};
+
+struct void_container {
+       struct container raw;
+       TCON(void *canary);
+};
+
+int main(int argc, char *argv[])
+{
+       struct void_container vcon;
+
+       tcon_check(&vcon, canary, NULL)->raw.p = NULL;
+       tcon_check(&vcon, canary, argv[0])->raw.p = NULL;
+       tcon_check(&vcon, canary, main)->raw.p = NULL;
+       return 0;
+}