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

stage2 compiler invalid circular dependency when using translate-c results #12958

Closed
bpeake13 opened this issue Sep 25, 2022 · 1 comment
Closed
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@bpeake13
Copy link

Zig Version

0.10.0-dev.4166+cae76d829

Steps to Reproduce

I encountered this with the flecs library. Here is the translate C result i was compiling with https://pastebin.com/j60WwuDC
Here is a simple program that will get the error

const std = @import("std");
const flecs = @import("flecs");

pub fn main() anyerror!void {
    var edesc = std.mem.zeroes(flecs.ecs_component_desc_t);
    _ = edesc;
}

Odly this doesn't occur unless I use a type that references iter_t, but using iter_t directly compiles fine.

Expected Behavior

This should compile. It compiles fine with stage1, and if you look at the references the circular ref is only due to pointer types, which should be fine to have as a circular reference. Likewise the reference is only through a function pointer, which should also be fine to have as a circular reference.

Actual Behavior

The program compiles with the following error:

error: dependency loop detected
pub const ecs_iter_action_t = ?*const fn ([*c]ecs_iter_t) callconv(.C) void;
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
    struct_ecs_iter_t: C:\Users\rayan\projects\quest-game\thirdparty\pkg\flecs.zig:1090:38
    ecs_iter_t: C:\Users\rayan\projects\quest-game\thirdparty\pkg\flecs.zig:1131:24
    ecs_iter_next_action_t: C:\Users\rayan\projects\quest-game\thirdparty\pkg\flecs.zig:1087:52
    struct_ecs_iter_t: C:\Users\rayan\projects\quest-game\thirdparty\pkg\flecs.zig:1126:11
@bpeake13 bpeake13 added the bug Observed behavior contradicts documented or intended behavior label Sep 25, 2022
@mitchellh
Copy link
Contributor

mitchellh commented Sep 25, 2022

Dupe: #12325

@Vexu Vexu closed this as completed Sep 28, 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
Projects
None yet
Development

No branches or pull requests

3 participants