Skip to content

stage2: Array type with child type being a function crashes the compiler #11543

@Hejsil

Description

@Hejsil

Zig Version

0.10.0-dev.1983+c5e847744

Steps to Reproduce

// test.zig
pub fn S() type {
    return struct {};
}

test "" {
    _ = [0]S;
}
$ stage2/zig test test.zig

Expected Behavior

A compile error along the lines of error: expected type, found fn() type

Actual Behavior

$ stage2/zig test test.zig
thread 226457 panic: zig compiler bug: NeededSourceLocation
...
zig/src/Module.zig:4923:39: 0x2faac63 in Module.analyzeFnBody (zig)
        error.NeededSourceLocation => @panic("zig compiler bug: NeededSourceLocation"),
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions