Skip to content

Combining labeled switch and inline switch prongs leads to compile error #24789

Description

@vweber

Zig Version

0.14.1

Steps to Reproduce and Observed Behavior

const TestEnum = enum {
    foo,
    bar,
};

fn x(t: TestEnum) void {
    sw: switch (t) {
        .foo => {},
        inline else => |_| {
            continue :sw .foo;
        },
    }
}
pub fn main() !void {
    x(.bar);
}

Compile error while building:

src/main.zig:9:17: error: expected pointer, found 'type'
    sw: switch (t) {
                ^

Expected Behavior

No compile errors, no runtime errors

Activity

  1. added
    bugObserved behavior contradicts documented or intended behavior
    on Aug 10, 2025
  2. added this to the 0.16.0 milestone on Jan 11, 2026
  3. mlugg commented on Jan 11, 2026

    @mlugg
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions