diff options
| author | yujiri8 <yujiri@disroot.org> | 2023-05-31 07:15:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-31 11:15:52 +0000 |
| commit | cd1417dbdf098634641e87dba4c3be2806d76250 (patch) | |
| tree | 86f37e2015cb84fd08ec260772b7bb6b40686811 /test | |
| parent | 32e719e070067333efa9d4888927b425d118fc97 (diff) | |
| download | zig-cd1417dbdf098634641e87dba4c3be2806d76250.tar.gz zig-cd1417dbdf098634641e87dba4c3be2806d76250.zip | |
don't crash when can't evaluate comptime expression with inferred type
Closes #15911.
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/compile_errors/unable_to_evaluate_comptime_expr_with_inferred_type.zig | 17 |
1 files changed, 17 insertions, 0 deletions
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 new file mode 100644 index 0000000000..3792cf2f82 --- /dev/null +++ b/test/cases/compile_errors/unable_to_evaluate_comptime_expr_with_inferred_type.zig @@ -0,0 +1,17 @@ +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 |
