]> git.ozlabs.org Git - ccan/blob - ccan/tlist2/test/compile_fail-tlist_for_each_2.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / tlist2 / test / compile_fail-tlist_for_each_2.c
1 #include <ccan/tlist2/tlist2.h>
2
3 struct child {
4         const char *name;
5         struct list_node list;
6 };
7
8 struct cousin {
9         const char *name;
10         struct list_node list;
11 };
12
13 int main(int argc, char *argv[])
14 {
15         TLIST2(struct child, list) children;
16         struct child child = { "child" };
17 #ifdef FAIL
18 #if !HAVE_FLEXIBLE_ARRAY_MEMBER
19 #error Need flexible array members to check type
20 #endif
21         struct cousin *c;
22 #else
23         struct child *c;
24 #endif
25
26         tlist2_init(&children);
27         tlist2_add(&children, &child);
28
29         tlist2_for_each(&children, c)
30                 (void) c; /* Suppress unused-but-set-variable warning. */
31         return 0;
32 }