Skip to content
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

erroneous dependency loop for globals self/mutually referencing the addresses of fields #22314

Closed
Fri3dNstuff opened this issue Dec 25, 2024 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@Fri3dNstuff
Copy link
Contributor

Zig Version

0.14.0-dev.2563+af5e73172

Steps to Reproduce and Observed Behavior

run zig test on the following code:

test {
    _ = s;
}

const S = struct { x: *const u64, y: u64 };
const s: S = .{ .x = &s.y, .y = 0 };

compiler outputs:

$ zig test oops.zig 
oops.zig:6:1: error: dependency loop detected
const s: S = .{ .x = &s.y, .y = 0 };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expected Behavior

The code should compile and run without errors;
although #22303 resolved #131, the compiler still seemingly fails for more complex place expressions.

@Fri3dNstuff Fri3dNstuff added the bug Observed behavior contradicts documented or intended behavior label Dec 25, 2024
@mlugg mlugg added the frontend Tokenization, parsing, AstGen, Sema, and Liveness. label Dec 25, 2024
@mlugg mlugg added this to the 0.14.0 milestone Dec 25, 2024
@mlugg
Copy link
Member

mlugg commented Dec 27, 2024

Oh, sorry, I must have missed this the other day: your version is just one commit too old. This works fine on master.

@mlugg mlugg closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2024
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 frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

2 participants