]> git.ozlabs.org Git - ccan/blob - ccan/tlist/test/compile_fail-tlist_tail.c
Merge remote-tracking branch 'origin/pr/50'
[ccan] / ccan / tlist / test / compile_fail-tlist_tail.c
1 #include <ccan/tlist/tlist.h>
2
3 TLIST_TYPE(children, struct child);
4
5 struct child {
6         const char *name;
7         struct list_node list;
8 };
9
10 struct cousin {
11         const char *name;
12         struct list_node list;
13 };
14
15 int main(int argc, char *argv[])
16 {
17         struct tlist_children children;
18         struct child child = { "child" };
19 #ifdef FAIL
20         struct cousin *c;
21 #else
22         struct child *c;
23 #endif
24
25         tlist_init(&children);
26         tlist_add(&children, &child, list);
27
28         c = tlist_tail(&children, list);
29         (void) c; /* Suppress unused-but-set-variable warning. */
30         return 0;
31 }