tlist: remove type arg from tlist_top(), tlist_tail()
[ccan] / ccan / tlist / test / compile_fail-tlist_top.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_top(&children, list);
29         (void) c; /* Suppress unused-but-set-variable warning. */
30         return 0;
31 }