Skip to content

Compiler crashes and gives no output #22583

Description

@Didas-git

Zig Version

0.14.0-dev.2909+f3c29dcb2

Steps to Reproduce and Observed Behavior

Create a new zig project using zig init and replace the main.zig file with the following:

const G = struct {
    const L = struct { [:0]const u8 };
    comptime list: []*L = &.{},

    pub fn get(comptime self: *G, pattern: [:0]const u8) void {
        comptime {
            var temp: L = .{pattern};
            self.list = self.list ++ @constCast(.{&temp});
        }
    }
};

pub fn main() !void {
    comptime {
        var t = G{};
        t.get("s");
    }
}

What is observed is that the compiler simply quits with code 1 and doesn't give any information on what the issue is.

We have also ran the code with a debug build and it does give us an error, im appending the output bellow.
Crash.log

Expected Behavior

I would expect to get an error message for why it fails to compile, the code is most likely not valid zig but as a new person in the zig ecosystem it's fairly hard to find out what's wrong when there is no output.

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