]> git.ozlabs.org Git - ccan/blobdiff - ccan/hashtable/test/compile_fail-traverse-arg2.c
hashtable: fix traverse typesafety.
[ccan] / ccan / hashtable / test / compile_fail-traverse-arg2.c
diff --git a/ccan/hashtable/test/compile_fail-traverse-arg2.c b/ccan/hashtable/test/compile_fail-traverse-arg2.c
new file mode 100644 (file)
index 0000000..5f6ea36
--- /dev/null
@@ -0,0 +1,31 @@
+#include <ccan/hashtable/hashtable.h>
+#include <ccan/hashtable/hashtable.c>
+#include <stdlib.h>
+
+struct foo {
+       int i;
+};
+
+struct bar {
+       int i;
+};
+
+static bool fn_foo_foo(struct foo *foo, 
+#ifdef FAIL
+                      struct foo *
+#else
+                      struct bar *
+#endif
+                      bar)
+{
+       return true;
+}
+
+int main(void)
+{
+       struct hashtable *ht = NULL;
+       struct bar *bar = NULL;
+
+       hashtable_traverse(ht, struct foo, fn_foo_foo, bar);
+       return 0;
+}