mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
Also modifies all incremental cases using `#expect_error` to include the errors and notes which are expected.
33 lines
649 B
Plaintext
33 lines
649 B
Plaintext
#target=x86_64-linux-selfhosted
|
|
#target=x86_64-linux-cbe
|
|
#target=x86_64-windows-cbe
|
|
#target=wasm32-wasi-selfhosted
|
|
#update=initial version
|
|
#file=main.zig
|
|
const E = enum { a, b, c };
|
|
const U = union(E) {
|
|
a: i32,
|
|
b: f64,
|
|
c: f64,
|
|
d: f64,
|
|
};
|
|
pub fn main() void {
|
|
const u: U = .{ .a = 123 };
|
|
_ = u;
|
|
}
|
|
#expect_error=main.zig:6:5: error: no field named 'd' in enum 'main.E'
|
|
#expect_error=main.zig:1:11: note: enum declared here
|
|
#update=remove invalid backing enum
|
|
#file=main.zig
|
|
const U = union {
|
|
a: i32,
|
|
b: f64,
|
|
c: f64,
|
|
d: f64,
|
|
};
|
|
pub fn main() void {
|
|
const u: U = .{ .a = 123 };
|
|
_ = u;
|
|
}
|
|
#expect_stdout=""
|