#zig build-obj {
--name test -fno-emit-bin
-Mroot=test.zig
#}

#write test.zig {
const E = enum {};
const U = union {
    foo: struct { a: u8, b: noreturn },
    bar: E,
};
export fn loadSliceUninstantiableEnum() void {
    const bytes: [32]u8 = @splat(0);
    const ptr: *const [1]E = @ptrCast(&bytes);
    const slice: []const E = ptr;
    _ = comptime slice[0];
    comptime unreachable;
}
export fn iterateSliceUninstantiableEnum() void {
    const bytes: [32]u8 = @splat(0);
    const ptr: *const [1]E = @ptrCast(&bytes);
    const slice: []const E = ptr;
    comptime for (slice) |elem| {
        _ = elem;
    };
    comptime unreachable;
}
export fn loadSliceUninstantiableUnion() void {
    const bytes: [32]u8 = @splat(0);
    const ptr: *const [1]U = @ptrCast(&bytes);
    const slice: []const U = ptr;
    _ = comptime slice[0];
    comptime unreachable;
}
export fn iterateSliceUninstantiableUnion() void {
    const bytes: [32]u8 = @splat(0);
    const ptr: *const [1]U = @ptrCast(&bytes);
    const slice: []const U = ptr;
    comptime for (slice) |elem| {
        _ = elem;
    };
    comptime unreachable;
}
#}
#update
#check errors {
test.zig:10:23: error: cannot load uninstantiable type 'test.E'
test.zig:1:11: note: enum declared here
test.zig:17:19: error: cannot load uninstantiable type 'test.E'
test.zig:1:11: note: enum declared here
test.zig:26:23: error: cannot load uninstantiable type 'test.U'
test.zig:2:11: note: union declared here
test.zig:33:19: error: cannot load uninstantiable type 'test.U'
test.zig:2:11: note: union declared here
#}
