We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using 0.6.0+1a4059ed8, this works:
const S = struct { a: ?*S, }; pub fn main() void { _ = @as(S, undefined); }
but this doesn't:
fn identity(comptime T: type) type { return T; } const S1 = struct { a: identity(?*S1), }; fn addOptionalPointer(comptime T: type) type { return ?*T; } const S2 = struct { a: addOptionalPointer(S2), }; const S3 = struct { a: @import("std").ArrayList(?*S3), }; pub fn main() void { _ = @as(S1, undefined); _ = @as(S2, undefined); _ = @as(S3, undefined); }
./main.zig:5:12: error: struct 'S1' depends on itself const S1 = struct { ^ ./main.zig:6:17: note: referenced here a: identity(?*S1), ^ ./main.zig:6:16: note: referenced here a: identity(?*S1), ^ ./main.zig:13:12: error: struct 'S2' depends on itself const S2 = struct { ^ ./main.zig:9:46: note: referenced here fn addOptionalPointer(comptime T: type) type { ^ ./main.zig:14:26: note: referenced here a: addOptionalPointer(S2), ^ ./main.zig:17:12: error: struct 'S3' depends on itself const S3 = struct { ^ ./main.zig:18:33: note: referenced here a: @import("std").ArrayList(?*S3), ^ ./main.zig:18:32: note: referenced here a: @import("std").ArrayList(?*S3), ^
(Trying the same thing with only ordinary pointers seems to work fine.) Related: #5414
The text was updated successfully, but these errors were encountered:
Duplicate of #4562.
Sorry, something went wrong.
No branches or pull requests
Using 0.6.0+1a4059ed8, this works:
but this doesn't:
(Trying the same thing with only ordinary pointers seems to work fine.)
Related: #5414
The text was updated successfully, but these errors were encountered: