Zig Version
0.10.0-dev.3475+b3d463c9e
Steps to Reproduce
Try compiling the following code with zig test -fno-stage1 -fLLVM comptime-bug.zig
const std = @import("std");
const S = struct { x: [4]i8 = std.mem.zeroes([4]i8) };
const M = struct { x: [4]S = std.mem.zeroes([4]S) };
comptime {
var res = M{};
@compileLog(res.x);
for (.{1, 2, 3}) |i| res.x[i].x[i] = i;
@compileLog(res.x);
}
Expected Behavior
Output should be
comptime-bug.zig:7:5: error: found compile log statement
@compileLog(res.x);
^~~~~~~~~~~~~~~~~~
Compile Log Output:
@as([4]comptime-bug.S, .{ .{.x = .{ 0, 0, 0, 0 }}, .{.x = .{ 0, 0, 0, 0 }}, .{.x = .{ 0, 0, 0, 0 }}, .{.x = .{ 0, 0, 0, 0 }} })
@as([4]comptime-bug.S, .{ .{.x = .{ 0, 0, 0, 0 }}, .{.x = .{ 0, 1, 0, 0 }}, .{.x = .{ 0, 0, 2, 0 }}, .{.x = .{ 0, 0, 0, 3 }} })
Actual Behavior
Output is
comptime-bug.zig:7:5: error: found compile log statement
@compileLog(res.x);
^~~~~~~~~~~~~~~~~~
Compile Log Output:
@as([4]comptime-bug.S, .{ .{.x = .{ 0, 0, 0, 0 }}, .{.x = .{ 0, 0, 0, 0 }}, .{.x = .{ 0, 0, 0, 0 }}, .{.x = .{ 0, 0, 0, 0 }} })
@as([4]comptime-bug.S, .{ .{.x = .{ 0, 1, 2, 3 }}, .{.x = .{ 0, 1, 2, 3 }}, .{.x = .{ 0, 1, 2, 3 }}, .{.x = .{ 0, 1, 2, 3 }} })
Zig Version
0.10.0-dev.3475+b3d463c9e
Steps to Reproduce
Try compiling the following code with
zig test -fno-stage1 -fLLVM comptime-bug.zigExpected Behavior
Output should be
Actual Behavior
Output is