mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
12 lines
242 B
Zig
12 lines
242 B
Zig
const Payload = union {
|
|
int: i64,
|
|
float: f64,
|
|
boolean: bool,
|
|
};
|
|
test "simple union" {
|
|
var payload = Payload{ .int = 1234 };
|
|
payload.float = 12.34;
|
|
}
|
|
|
|
// test_error=access of union field 'float' while field 'int' is active
|