Changeset d958834b for tests/enum_tests
- Timestamp:
- Jul 25, 2022, 12:29:40 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- b729c01
- Parents:
- d4b37ab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/enum_tests/structEnum.cfa
rd4b37ab rd958834b 2 2 3 3 struct Point { 4 int x;5 char y;4 int x; 5 char y; 6 6 }; 7 7 8 8 enum(Point) PointEnum { 9 first={10 100,11 'c'12 },13 second={14 200,15 'a'16 }9 first={ 10 100, 11 'c' 12 }, 13 second={ 14 200, 15 'a' 16 } 17 17 }; 18 19 PointEnum foo(PointEnum in) { 20 return in; 21 } 18 22 19 23 // The only valid usage 20 24 struct Point apple = first; 21 25 // Failed due to Qualified name is currently unimplemented. 22 //struct Point banana = PointEnum.first;26 struct Point banana = PointEnum.first; 23 27 24 28 int 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; 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; 30 39 }
Note: See TracChangeset
for help on using the changeset viewer.