Skip to content

Assertion failed in get_struct_type when return type of frame struct member is error union #8654

@Hadron67

Description

@Hadron67

The following top-level scope code

frame: @Frame(hkm),
fn hkm(_: void) !void {}

crashes the compiler with

Assertion failed at /home/vsts/work/1/s/src/stage1/analyze.cpp:2261 in get_struct_type. This is a bug in the Zig compiler.thread 29889 panic: 
Unable to dump stack trace: debug info stripped

This also occurs if a sub-frame returns error union. Frame functions taken from a submodule is also affected.

const H = struct {
    pub fn soor() void {
        const h: @Frame(rfnj) = undefined;
    }
    fn rfnj(_: void) !void {}
};

frame: @Frame(H.soor),

But if the frame is not a top-level member, the error doesn't occur:

const Hkm = struct {
    frame: @Frame(hkm),
    fn hkm(_: void) !void {}
};
comptime {
    _ = Hkm;
}

It's also fixed by removing all arguments of the frame function, or changing the return type to something other than an error union.

Using zig-linux-x86_64-0.8.0-dev.2064+da9da76e3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions