Skip to content

False positive "Foo depends on itself" #1500

@ghost

Description

const A = struct {
    b: B,
};

const B = fn(A) void;

pub fn main() void {
    //var a: A = undefined; // uncomment this line for: segfault
    //var b: B = undefined; // uncomment this line for: error: 'B' depends on itself
}
const B = fn(*A) void; // changing the definition of B slightly, now the below compiles without a segfault or compile errors
pub fn main() void {
    var a: A = undefined;
}

This code should compile. In fact B looks a lot like a virtual function taking a 'this' by value or by pointer. translate-c on uv.h (libuv) gives the error "uv_close_cb depends on itself" which is how I came across this bug.

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