zig/test/behavior/bugs/11182.zig
Cody Tapscott 480e7eec65 stage2: Fix panic on initializing comptime fields in tuple
This resolves https://github.com/ziglang/zig/issues/11159

The problem was that:
  1. We were not correctly deleting the field stores after recognizing
     that an array initializer was a comptime-known value.
  2. LLVM was not checking that the final type had no runtime bits, and
     so would generate an invalid store.

This also adds several test cases for related bugs, just to check these
in for later work.
2022-03-15 17:01:16 -07:00

11 lines
237 B
Zig

const std = @import("std");
const builtin = @import("builtin");
test {
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
const T = @TypeOf(.{ @as(i32, 0), @as(u32, 0) });
var a = T{ 0, 0 };
_ = a;
}