source: tests/enum_tests/structEnum.cfa @ 43aec9e

pthread-emulationqualifiedEnum
Last change on this file since 43aec9e was fc134a48, checked in by JiadaL <j82liang@…>, 8 months ago

Implement the struct enum

  • Property mode set to 100644
File size: 558 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
19// The only valid usage
20struct Point apple = first;
21// Failed due to Qualified name is currently unimplemented.
22// struct Point banana = PointEnum.first;
23
24int main() {
25    printf("%d %c\n", apple.x, apple.y);
26    // Failed; enumInstType is now not a real type and not instantiated.
27    // Not sure if we want that
28    // printf("%d %c\n", second.x, second.y);
29    return 0;
30}
31
32
33
Note: See TracBrowser for help on using the repository browser.