aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-03-05 12:39:32 +0000
committerAndrew Kelley <andrew@ziglang.org>2023-04-12 12:06:19 -0400
commitccf670c2b04ebeb9db43eb9f5c47c6cf03e4b1d0 (patch)
tree3f7899bf6231500782af185ffe701ee66793e226 /test/behavior
parent602029bb2fb78048e46136784e717b57b8de8f2c (diff)
downloadzig-ccf670c2b04ebeb9db43eb9f5c47c6cf03e4b1d0.tar.gz
zig-ccf670c2b04ebeb9db43eb9f5c47c6cf03e4b1d0.zip
Zir: implement explicit block_comptime instruction
Resolves: #7056
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/cast.zig11
-rw-r--r--test/behavior/eval.zig4
2 files changed, 2 insertions, 13 deletions
diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig
index 8027515730..16efe710e3 100644
--- a/test/behavior/cast.zig
+++ b/test/behavior/cast.zig
@@ -1455,7 +1455,7 @@ test "floatToInt to zero-bit int" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
- var a: f32 = 0.0;
+ const a: f32 = 0.0;
comptime try std.testing.expect(@floatToInt(u0, a) == 0);
}
@@ -1507,15 +1507,6 @@ test "optional pointer coerced to optional allowzero pointer" {
try expect(@ptrToInt(q.?) == 4);
}
-test "ptrToInt on const inside comptime block" {
- var a = comptime blk: {
- const b: u8 = 1;
- const c = @ptrToInt(&b);
- break :blk c;
- };
- try expect(@intToPtr(*const u8, a).* == 1);
-}
-
test "single item pointer to pointer to array to slice" {
var x: i32 = 1234;
try expect(@as([]const i32, @as(*[1]i32, &x))[0] == 1234);
diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig
index 214f2beb07..302de93591 100644
--- a/test/behavior/eval.zig
+++ b/test/behavior/eval.zig
@@ -181,9 +181,7 @@ fn testTryToTrickEvalWithRuntimeIf(b: bool) usize {
const result = if (b) false else true;
_ = result;
}
- comptime {
- return i;
- }
+ return comptime i;
}
test "@setEvalBranchQuota" {