| ... | ... | @@ -1143,3 +1143,17 @@ test "orelse coercion as function argument" { |
| 1143 | 1143 | var foo = Container.init(optional orelse .{}); |
| 1144 | 1144 | try expect(foo.a.?.start == -1); |
| 1145 | 1145 | } |
| 1146 | |
| 1147 | test "runtime-known globals initialized with undefined" { |
| 1148 | const S = struct { |
| 1149 | var array: [10]u32 = [_]u32{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; |
| 1150 | var vp: [*]u32 = undefined; |
| 1151 | var s: []u32 = undefined; |
| 1152 | }; |
| 1153 | |
| 1154 | S.vp = &S.array; |
| 1155 | S.s = S.vp[0..5]; |
| 1156 | |
| 1157 | try expect(S.s[0] == 1); |
| 1158 | try expect(S.s[4] == 5); |
| 1159 | } |