diff options
Diffstat (limited to 'lib/ccan/asearch/test/compile_fail-return-value.c')
-rw-r--r-- | lib/ccan/asearch/test/compile_fail-return-value.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/ccan/asearch/test/compile_fail-return-value.c b/lib/ccan/asearch/test/compile_fail-return-value.c new file mode 100644 index 0000000000..4aef5327a8 --- /dev/null +++ b/lib/ccan/asearch/test/compile_fail-return-value.c @@ -0,0 +1,22 @@ +#include <ccan/asearch/asearch.h> + +static int cmp(const char *key, char *const *elem) +{ + return 0; +} + +int main(int argc, char **argv) +{ + const char key[] = "key"; + +#ifdef FAIL + int **p; +#if !HAVE_TYPEOF +#error "Unfortunately we don't fail if no typeof." +#endif +#else + char **p; +#endif + p = asearch(key, argv+1, argc-1, cmp); + return p ? 0 : 1; +} |