source:
tests/enum_tests/structEnum.cfa
@
ad47ec4
Last change on this file since ad47ec4 was c333ed2, checked in by , 6 months ago | |
---|---|
|
|
File size: 691 bytes |
Rev | Line | |
---|---|---|
[fc134a48] | 1 | #include <stdio.h> |
2 | ||
3 | struct Point { | |
[d958834b] | 4 | int x; |
5 | char y; | |
[fc134a48] | 6 | }; |
7 | ||
8 | enum(Point) PointEnum { | |
[d958834b] | 9 | first={ |
10 | 100, | |
11 | 'c' | |
12 | }, | |
13 | second={ | |
14 | 200, | |
15 | 'a' | |
16 | } | |
[fc134a48] | 17 | }; |
18 | ||
[c333ed2] | 19 | PointEnum identity(PointEnum in) { |
20 | return in; | |
21 | } | |
[d958834b] | 22 | |
[fc134a48] | 23 | // The only valid usage |
24 | struct Point apple = first; | |
25 | // Failed due to Qualified name is currently unimplemented. | |
26 | ||
27 | int main() { | |
[d958834b] | 28 | PointEnum vals = second; |
29 | PointEnum val2; | |
[12df6fe] | 30 | // The failing line: assignment |
31 | // val2 = vals; | |
[d958834b] | 32 | |
33 | printf("%d %c\n", apple.x, apple.y); | |
34 | // Failed; enumInstType is now not a real type and not instantiated. | |
35 | // Not sure if we want that | |
36 | // printf("%d %c\n", second.x, second.y); | |
37 | return 0; | |
[fc134a48] | 38 | } |
Note: See TracBrowser
for help on using the repository browser.