Skip to content

Compiler crash if struct contains optional empty struct #3586

@ghost

Description

const std = @import("std");

const NoteParams = struct {};

const Container = struct {
    params: ?NoteParams,
};

pub fn main() void {
    var ctr = Container {
        .params = NoteParams {},
    };
}

Compiler crashes at a random point (or maybe it's just an artifact of the progress thing). Example outputs from three attempts:

Code Generation [277/442] std.os.write...when analyzing /home/dbandstra/oxid/asdf.zig:10:5: assertion failed. This is a bug in the Zig compiler.
Code Generation [304/442] std.mem.Allocator.free...when analyzing /home/dbandstra/oxid/asdf.zig:10:5: assertion failed. This is a bug in the Zig compiler.
Code Generation [331/442] std.fmt.formatType...when analyzing /home/dbandstra/oxid/asdf.zig:10:5: assertion failed. This is a bug in the Zig compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions