diff --git a/test/behavior/bugs/6456.zig b/test/behavior/bugs/6456.zig index c0c6a97f03..3821cccdd0 100644 --- a/test/behavior/bugs/6456.zig +++ b/test/behavior/bugs/6456.zig @@ -19,7 +19,7 @@ test "issue 6456" { .alignment = 0, .name = name, .field_type = usize, - .default_value = @as(?usize, null), + .default_value = &@as(?usize, null), .is_comptime = false, }}; } diff --git a/test/stage2/llvm.zig b/test/stage2/llvm.zig index 820768efe3..eaeb76462a 100644 --- a/test/stage2/llvm.zig +++ b/test/stage2/llvm.zig @@ -422,4 +422,17 @@ pub fn addCases(ctx: *TestContext) !void { \\} , ""); } + + { + // This worked in stage1 and we expressly do not want this to work in stage2 + var case = ctx.exeUsingLlvmBackend("any typed null to any typed optional", linux_x64); + case.addError( + \\pub export fn main() void { + \\ var a: ?*anyopaque = undefined; + \\ a = @as(?usize, null); + \\} + , &[_][]const u8{ + ":3:21: error: expected pointer type, found '?usize'", + }); + } }