Skip to content

conflicting extern and export declarations allowed in same compilation #23822

@190n

Description

@190n

Zig Version

0.14.0

Steps to Reproduce and Observed Behavior

Try to compile code like the following (with zig build-obj):

export fn foo() u32 {
    return 123456;
}

export fn bar() u16 {
    const inner = struct {
        extern fn foo() u16;
    };
    return inner.foo();
}

It compiles successfully.

Expected Behavior

There should be an error because the declaration and definition of foo don't match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions