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

#write test.zig {
const EnumInferred = enum {};
const EnumExplicit = enum(noreturn) {};
const EnumNonexhaustive = enum(u8) { _ };

const U0 = union {};
const U1 = union(enum) {};
const U2 = union(enum(noreturn)) {};
const U3 = union(EnumInferred) {};
const U4 = union(EnumExplicit) {};
const U5 = union(EnumNonexhaustive) {};

export fn init0() void {
    _ = @as(U0, undefined);
}
export fn init1() void {
    _ = @as(U1, undefined);
}
export fn init2() void {
    _ = @as(U2, undefined);
}
export fn init3() void {
    _ = @as(U3, undefined);
}
export fn init4() void {
    _ = @as(U4, undefined);
}
export fn init5() void {
    _ = @as(U5, undefined);
}
#}
#update
#check errors {
test.zig:13:17: error: expected type 'test.U0', found '@TypeOf(undefined)'
test.zig:13:17: note: cannot coerce to uninstantiable type 'test.U0'
test.zig:5:12: note: union declared here
test.zig:16:17: error: expected type 'test.U1', found '@TypeOf(undefined)'
test.zig:16:17: note: cannot coerce to uninstantiable type 'test.U1'
test.zig:6:12: note: union declared here
test.zig:19:17: error: expected type 'test.U2', found '@TypeOf(undefined)'
test.zig:19:17: note: cannot coerce to uninstantiable type 'test.U2'
test.zig:7:12: note: union declared here
test.zig:22:17: error: expected type 'test.U3', found '@TypeOf(undefined)'
test.zig:22:17: note: cannot coerce to uninstantiable type 'test.U3'
test.zig:8:12: note: union declared here
test.zig:25:17: error: expected type 'test.U4', found '@TypeOf(undefined)'
test.zig:25:17: note: cannot coerce to uninstantiable type 'test.U4'
test.zig:9:12: note: union declared here
test.zig:28:17: error: expected type 'test.U5', found '@TypeOf(undefined)'
test.zig:28:17: note: cannot coerce to uninstantiable type 'test.U5'
test.zig:10:12: note: union declared here
#}
