-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.15.2
Steps to Reproduce and Observed Behavior
Sorry for the bulky issue name :< The bug is just kinda that specific.
const TaggedUnion = union(enum) {
a: u32,
b: i32,
c: void,
};
// In some function...
const tu: TaggedUnion = .{ .a = 15 };
sw: switch (tu) {
inline else => |_, tag| {
// Code body doesn't matter, but presumably you're using tag somewhere.
_ = tag;
continue :sw next; // Any continue value still fails
},
}The code above will fail to compile with no sensible error (only returning error code 1), despite the fact that this should be valid as far as I can tell.
Replacing inline else => |_, tag| with inline else => |value, tag| and then discarding value using _ = value compiles just fine.
I don't personally see any use cases where this would actually matter, but it definitely shouldn't just crash without explanation like it does.
Expected Behavior
The given code should compile, or if it's not valid for some reason, it should return an actual compiler error instead of simply crashing the compiler.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior