aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-12-28 12:34:41 +0200
committerVeikka Tuominen <git@vexu.eu>2022-12-29 12:43:02 +0200
commit8a6295fcba80be9a145d59b103b6ec8d19636b38 (patch)
tree0a64969fa1fcaabcd8c98e05e2e5d4087b9398c8 /src
parent9a0c593a547eec03a527afaac13fcf11f799c20f (diff)
downloadzig-8a6295fcba80be9a145d59b103b6ec8d19636b38.tar.gz
zig-8a6295fcba80be9a145d59b103b6ec8d19636b38.zip
AstGen: make type sentinel expressions implicitly comptime
Diffstat (limited to 'src')
-rw-r--r--src/AstGen.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 1f8e2dd881..e70424188a 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -3365,7 +3365,7 @@ fn ptrType(
var trailing_count: u32 = 0;
if (ptr_info.ast.sentinel != 0) {
- sentinel_ref = try expr(gz, scope, .{ .rl = .{ .ty = elem_type } }, ptr_info.ast.sentinel);
+ sentinel_ref = try comptimeExpr(gz, scope, .{ .rl = .{ .ty = elem_type } }, ptr_info.ast.sentinel);
trailing_count += 1;
}
if (ptr_info.ast.align_node != 0) {
@@ -3468,7 +3468,7 @@ fn arrayTypeSentinel(gz: *GenZir, scope: *Scope, ri: ResultInfo, node: Ast.Node.
}
const len = try reachableExpr(gz, scope, .{ .rl = .{ .coerced_ty = .usize_type } }, len_node, node);
const elem_type = try typeExpr(gz, scope, extra.elem_type);
- const sentinel = try reachableExpr(gz, scope, .{ .rl = .{ .coerced_ty = elem_type } }, extra.sentinel, node);
+ const sentinel = try reachableExprComptime(gz, scope, .{ .rl = .{ .coerced_ty = elem_type } }, extra.sentinel, node, true);
const result = try gz.addPlNode(.array_type_sentinel, node, Zir.Inst.ArrayTypeSentinel{
.len = len,