Skip to content

Assertion failed at /deps/zig/src/analyze.cpp:605 in get_pointer_to_type_extra2. This is a bug in the Zig compiler. #4380

@metaleap

Description

@metaleap

First off, the below will build & run / pass:

const std = @import("std");

test "" {
    main();
}

pub fn main() void {
    _ = (Options{}).isFoo;
}

pub const Options = struct {
    isFoo: ?fn (type, []const u8, type) bool = defaultIsFoo,

    pub fn defaultIsFoo(comptime struct_type: type, field_name: []const u8, comptime field_type: type) bool {
        return false;
    }
};

Now remove the Optional-? for the isFoo field, and Assertion failed at /deps/zig/src/analyze.cpp:605 in get_pointer_to_type_extra2. This is a bug in the Zig compiler.

Same if isFoos signature is given arg names and comptime qualifier. Which aren't needed, judging by how well it all works as expected/intended while I had them optionals.

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