Skip to content

Error message cursor at wrong position for packed struct containing packed union #22088

@ghost

Description

Zig Version

0.14.0-dev.2273+73dcd1914

Steps to Reproduce and Observed Behavior

const X = packed struct {
    a: packed union {
        b: u8,
    },
};

test {
    const y: X = undefined;
    y.a = .{ .b = 0 };
}
x.zig:9:19: error: cannot assign to constant
    y.a = .{ .b = 0 };
                  ^

Expected Behavior

x.zig:9:19: error: cannot assign to constant
    y.a = .{ .b = 0 };
    ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions