diff --git a/src/Sema.zig b/src/Sema.zig index 57de32396dcd505780922a638574dd6daf345a6f..52e4b4fac456918dc809ef5a8173a602a4142937 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -4508,6 +4508,7 @@ fn zirCompileLog( const arg = try sema.resolveInst(arg_ref); const arg_ty = sema.typeOf(arg); if (try sema.resolveMaybeUndefVal(block, src, arg)) |val| { + try sema.resolveLazyValue(block, src, val); try writer.print("@as({}, {})", .{ arg_ty.fmt(sema.mod), val.fmtValue(arg_ty, sema.mod), }); @@ -25440,6 +25441,10 @@ fn resolveLazyValue( const ty = val.castTag(.lazy_align).?.data; return sema.resolveTypeLayout(block, src, ty); }, + .lazy_size => { + const ty = val.castTag(.lazy_size).?.data; + return sema.resolveTypeLayout(block, src, ty); + }, else => return, } } diff --git a/test/cases/compile_errors/compile_log.zig b/test/cases/compile_errors/compile_log.zig index 281f8747d23fbba125e5236f8499673b40cdaa34..772853b0232751c193c7316a5acb5ee1e3735a97 100644 --- a/test/cases/compile_errors/compile_log.zig +++ b/test/cases/compile_errors/compile_log.zig @@ -6,9 +6,14 @@ fn bar(a: i32, b: []const u8) void { @compileLog("a", a, "b", b); @compileLog("end",); } +export fn baz() void { + const S = struct { a: u32 }; + @compileLog(@sizeOf(S)); +} // error // backend=llvm // target=native // // :5:5: error: found compile log statement +// :11:5: note: also here