Skip to content

Struct with aligned pointer to itself "depends on itself" #13308

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
17dec opened this issue Oct 26, 2022 · 1 comment
Closed

Struct with aligned pointer to itself "depends on itself" #13308

17dec opened this issue Oct 26, 2022 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@17dec
Copy link

17dec commented Oct 26, 2022

Zig Version

0.10.0-dev.4563+55c5da1b2

Steps to Reproduce

const E = struct {
    next: ?*align(1) E,
};

test "x" {
    _ = E{.next = null};
}

Somehow the align(1) is causing a dependency on self.

Expected Behavior

No error. I wasn't expecting structs with align(1) pointers to self to behave differently from structs with regular pointers to self.

Actual Behavior

t.zig:1:11: error: struct 't.E' depends on itself
const E = struct {
          ^~~~~~
referenced by:
    E: t.zig:1:11
    E: t.zig:2:22
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
@17dec 17dec added the bug Observed behavior contradicts documented or intended behavior label Oct 26, 2022
@17dec
Copy link
Author

17dec commented Oct 26, 2022

Actually, this might be the same as #12325.

@Vexu Vexu added the frontend Tokenization, parsing, AstGen, Sema, and Liveness. label Oct 26, 2022
@Vexu Vexu added this to the 0.10.1 milestone Oct 26, 2022
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