Skip to content

False dependency loop with function pointer #14353

@mitchellh

Description

@mitchellh

Zig Version

0.11.0-dev.1329+37424fd11

Steps to Reproduce and Observed Behavior

zig test test.zig:

pub const A = struct {
    field: B = undefined,
};

pub const B = struct {
    field: *const fn (*A) void,
};

test {
    var a: usize = @sizeOf(B);
    _ = a;
}

Some notes:

  • Must be runtime, comptime works fine (var vs const)
  • Must be function pointer, regular pointer to *A works fine
  • Must have initializer on A's field

Expected Behavior

No error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions