| 1 | var n: u8 = 5; |
| 2 | |
| 3 | const S = struct { |
| 4 | a: u8, |
| 5 | }; |
| 6 | |
| 7 | var a: S = .{ .a = n }; |
| 8 | |
| 9 | pub export fn entry1() void { |
| 10 | _ = a; |
| 11 | } |
| 12 | |
| 13 | var b: S = S{ .a = n }; |
| 14 | |
| 15 | pub export fn entry2() void { |
| 16 | _ = b; |
| 17 | } |
| 18 | |
| 19 | // error |
| 20 | // |
| 21 | // :7:13: error: unable to evaluate comptime expression |
| 22 | // :7:16: note: operation is runtime due to this operand |
| 23 | // :7:13: note: initializer of container-level variable must be comptime-known |
| 24 | // :13:13: error: unable to evaluate comptime expression |
| 25 | // :13:16: note: operation is runtime due to this operand |
| 26 | // :13:13: note: initializer of container-level variable must be comptime-known |