source: tests/poly-o-cycle.cfa @ b0708ea

Last change on this file since b0708ea was 10b5970, checked in by Michael Brooks <mlbrooks@…>, 13 days ago

Fix many test-suite- and libcfa-caused unused variable warnings.

In scope are easy fixes among tests whose sole warnings were unused variable. Reduces the wflags lax list by 40%.

  • Property mode set to 100644
File size: 413 bytes
Line 
1// Check that a cycle of polymorphic otype structures can be instancated.
2
3forall(T)
4struct func_table;
5
6forall(U)
7struct object {
8        func_table(U) * virtual_table;
9};
10
11forall(T)
12struct func_table {
13        void (*object_func)(object(T) *);
14};
15
16void func(object(int) *) {
17        printf("Success!\n");
18}
19
20func_table(int) an_instance = { func };
21
22int main() {
23        object(int) x = { 0p };
24        an_instance.object_func( &x );
25        return 0;
26}
Note: See TracBrowser for help on using the repository browser.