zig/test/behavior/bugs/11181.zig
Mitchell Hashimoto 7d0b6956c0 stage2: resolve type fully when resolving inferred allocs
We must resolve the type fully so that pointer children (i.e. slices)
are resolved. Additionally, we must resolve even if we can know the
value at comptime because the `alloc_inferred` ZIR always produces a
constant in the AIR.

Fixes #11181
2022-03-15 19:55:21 -04:00

32 lines
880 B
Zig

const builtin = @import("builtin");
test "const inferred array of slices" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const T = struct { v: bool };
const decls = [_][]const T{
&[_]T{
.{ .v = false },
},
};
_ = decls;
}
test "var inferred array of slices" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const T = struct { v: bool };
var decls = [_][]const T{
&[_]T{
.{ .v = false },
},
};
_ = decls;
}