diff options
| author | Evin Yulo <yujiri@disroot.org> | 2023-05-31 08:05:55 -0400 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-05-31 19:18:36 +0300 |
| commit | 3085e2af4197193f08ea95d80afb2cf982227334 (patch) | |
| tree | 5bdd8be63ea03f2396e1d35fe5a50697f7ce6710 /test/cases/compile_errors | |
| parent | cd1417dbdf098634641e87dba4c3be2806d76250 (diff) | |
| download | zig-3085e2af4197193f08ea95d80afb2cf982227334.tar.gz zig-3085e2af4197193f08ea95d80afb2cf982227334.zip | |
add missing note "operation is runtime due to this operand"
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig | 26 | ||||
| -rw-r--r-- | test/cases/compile_errors/unable_to_evaluate_comptime_expr_with_inferred_type.zig | 17 |
2 files changed, 26 insertions, 17 deletions
diff --git a/test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig b/test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig new file mode 100644 index 0000000000..1c439316bc --- /dev/null +++ b/test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig @@ -0,0 +1,26 @@ +var n: u8 = 5; + +const S = struct { + a: u8, +}; + +var a: S = .{ .a = n }; + +pub export fn entry1() void { + _ = a; +} + +var b: S = S{ .a = n }; + +pub export fn entry2() void { + _ = b; +} + +// error +// backend=stage2 +// target=native +// +// :7:13: error: unable to evaluate comptime expression +// :7:16: note: operation is runtime due to this operand +// :13:13: error: unable to evaluate comptime expression +// :13:16: note: operation is runtime due to this operand diff --git a/test/cases/compile_errors/unable_to_evaluate_comptime_expr_with_inferred_type.zig b/test/cases/compile_errors/unable_to_evaluate_comptime_expr_with_inferred_type.zig deleted file mode 100644 index 3792cf2f82..0000000000 --- a/test/cases/compile_errors/unable_to_evaluate_comptime_expr_with_inferred_type.zig +++ /dev/null @@ -1,17 +0,0 @@ -const A = struct { - a: u8, -}; - -var n: u8 = 5; -var a: A = .{ .a = n }; - -pub export fn entry() void { - _ = a; -} - -// error -// backend=stage2 -// target=native -// -// :6:13: error: unable to evaluate comptime expression -// :6:16: note: operation is runtime due to this operand |
