| 1 | (* A named record or array constant as an element of an array constant, |
| 2 | and a constant with an address in it. *) |
| 3 | module ConstOfConst; |
| 4 | import Sys; |
| 5 | |
| 6 | type R = record a: INT; s: []const U8; end; |
| 7 | |
| 8 | const X: R = {a: 1, s: "one"}; |
| 9 | const Row: [2]INT = [3, 4]; |
| 10 | const Y: [2]R = [X, {a: 2, s: "two"}]; |
| 11 | const Grid: [2][2]INT = [Row, [5, 6]]; |
| 12 | |
| 13 | proc main*; |
| 14 | begin |
| 15 | _ := Sys.write(Sys.stdout, Y[0].s); |
| 16 | _ := Sys.write(Sys.stdout, Y[1].s); |
| 17 | _ := Sys.write(Sys.stdout, "\n"); |
| 18 | if (Y[0].a # 1) or (Y[1].a # 2) or (Grid[0][1] # 4) or (Grid[1][0] # 5) then Sys.exit(1); end; |
| 19 | end; |
| 20 | end ConstOfConst. |