source: tests/global-monomorph.cfa @ b12e4ad

Last change on this file since b12e4ad was fd54fef, checked in by Michael Brooks <mlbrooks@…>, 4 years ago

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

  • Property mode set to 100644
File size: 725 bytes
Line 
1// Create monomorphic instances of polymorphic types at global scope.
2
3forall(T &)
4void poly0(T &) {}
5
6forall(T & | sized(T))
7void poly1(T &) {}
8
9forall(T)
10void poly2(T &) {}
11
12struct wrapper {
13    void (*mono)(int &);
14};
15
16/* These are failing (#193):
17void (*mono0)(int &) = poly0;
18void (*mono1)(int &) = poly1;
19void (*mono2)(int &) = poly2;
20struct wrapper mono0w = { poly0 };
21struct wrapper mono1w = { poly1 };
22struct wrapper mono2w = { poly2 };
23*/
24void (*mono0c)(int &) @= poly0;
25void (*mono1c)(int &) @= poly1;
26void (*mono2c)(int &) @= poly2;
27struct wrapper mono0wc @= { poly0 };
28struct wrapper mono1wc @= { poly1 };
29struct wrapper mono2wc @= { poly2 };
30
31int main(void) {
32        printf("Compilation Successful.\n");
33        return 0;
34}
Note: See TracBrowser for help on using the repository browser.