source: tests/enum_tests/structEnum.cfa @ b0d9ff7

ADTast-experimentalpthread-emulationqualifiedEnum
Last change on this file since b0d9ff7 was d958834b, checked in by JiadaL <j82liang@…>, 2 years ago

Save a minimal compilable version. The enum pointer assignment/comparsion is fixed

  • Property mode set to 100644
File size: 696 bytes
Line 
1#include <stdio.h>
2
3struct Point {
4     int x;
5     char y;
6};
7
8enum(Point) PointEnum {
9     first={
10         100,
11         'c'
12     },
13     second={
14         200,
15         'a'
16     }
17};
18
19PointEnum foo(PointEnum in) {
20     return in;
21}
22
23// The only valid usage
24struct Point apple = first;
25// Failed due to Qualified name is currently unimplemented.
26struct Point banana = PointEnum.first;
27
28int main() {
29     PointEnum vals = second;
30     PointEnum val2;
31     // P1
32     val2 = vals;
33
34     printf("%d %c\n", apple.x, apple.y);
35     // Failed; enumInstType is now not a real type and not instantiated.
36     // Not sure if we want that
37     // printf("%d %c\n", second.x, second.y);
38     return 0;
39}
Note: See TracBrowser for help on using the repository browser.