Skip to content

False positive "Foo depends on itself" #1500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Sep 11, 2018 · 1 comment
Closed

False positive "Foo depends on itself" #1500

ghost opened this issue Sep 11, 2018 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@ghost
Copy link

ghost commented Sep 11, 2018

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.

@andrewrk
Copy link
Member

Might be related to #624

@andrewrk andrewrk added this to the 0.3.0 milestone Sep 11, 2018
@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label Sep 11, 2018
@andrewrk andrewrk modified the milestones: 0.3.0, 0.4.0 Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

1 participant