mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
4f7344dec0
Unions with no fields are now "uninstantiable" types, which work like `noreturn` in that values of this type cannot exist. Enums with no fields are different because they are currently considered `extern` types, though https://github.com/ziglang/zig/issues/19855 will change this in the future.
9 lines
140 B
Zig
9 lines
140 B
Zig
export fn foo() void {
|
|
const U = extern union {};
|
|
_ = @as(U, undefined);
|
|
}
|
|
|
|
// error
|
|
//
|
|
// :2:22: error: extern union has no fields
|