If both are used, 'else' handles named members and '_' handles unnamed members. In this case the 'else' prong will be unrolled to an explicit case containing all remaining named values.
28 lines
383 B
Zig
28 lines
383 B
Zig
const E = enum(u8) {
|
|
a,
|
|
b,
|
|
_,
|
|
};
|
|
|
|
export fn f(e: E) void {
|
|
switch (e) {
|
|
.a => {},
|
|
inline _ => {},
|
|
}
|
|
}
|
|
|
|
export fn g(e: E) void {
|
|
switch (e) {
|
|
.a => {},
|
|
else => {},
|
|
inline _ => {},
|
|
}
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :10:16: error: cannot inline '_' prong
|
|
// :18:16: error: cannot inline '_' prong
|