source: tests/poly-d-cycle.cfa @ 92bfda0

arm-ehjacob/cs343-translationnew-ast-unique-expr
Last change on this file since 92bfda0 was afe2939, checked in by Andrew Beach <ajbeach@…>, 14 months ago

Removed #include <stdio.h> from tests that only use printf.

  • Property mode set to 100644
File size: 454 bytes
RevLine 
[91131689]1// Check that a cycle of polymorphic dtype structures can be instancated.
[3f06c05]2
[91131689]3forall(dtype T)
[3f06c05]4struct func_table;
5
[91131689]6forall(dtype U)
[3f06c05]7struct object {
8        func_table(U) * virtual_table;
9};
10
[91131689]11forall(dtype T)
[3f06c05]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(int argc, char * argv[]) {
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.