Commit 12ce6eb8f6
Changed files (2)
src-self-hosted
test
stage2
src-self-hosted/zir_sema.zig
@@ -643,8 +643,12 @@ fn analyzeInstBreakVoid(mod: *Module, scope: *Scope, inst: *zir.Inst.BreakVoid)
}
fn analyzeInstDbgStmt(mod: *Module, scope: *Scope, inst: *zir.Inst.NoOp) InnerError!*Inst {
- const b = try mod.requireRuntimeBlock(scope, inst.base.src);
- return mod.addNoOp(b, inst.base.src, Type.initTag(.void), .dbg_stmt);
+ if (scope.cast(Scope.Block)) |b| {
+ if (!b.is_comptime) {
+ return mod.addNoOp(b, inst.base.src, Type.initTag(.void), .dbg_stmt);
+ }
+ }
+ return mod.constVoid(scope, inst.base.src);
}
fn analyzeInstDeclRefStr(mod: *Module, scope: *Scope, inst: *zir.Inst.DeclRefStr) InnerError!*Inst {
test/stage2/test.zig
@@ -973,8 +973,8 @@ pub fn addCases(ctx: *TestContext) !void {
\\comptime {
\\ _ = foo;
\\}
- \\extern var foo;
- , &[_][]const u8{":2:5: error: unable to resolve comptime value"});
+ \\extern var foo: i32;
+ , &[_][]const u8{":2:9: error: unable to resolve comptime value"});
case.addError(
\\export fn entry() void {
\\ _ = foo;