zig/test/behavior/bugs/529.zig
Andrew Kelley e9fc58eab7 LLVM: handle extern function name collisions
Zig allows multiple extern functions with the same name, and the
backends have to handle this possibility.

For LLVM, we keep a sparse map of collisions, and then resolve them in
flushModule(). This introduces some technical debt that will have to be
resolved when adding incremental compilation support to the LLVM
backend.
2022-06-07 00:47:10 -04:00

23 lines
665 B
Zig

const A = extern struct {
field: c_int,
};
extern fn issue529(?*A) void;
comptime {
_ = @import("529_other_file_2.zig");
}
const builtin = @import("builtin");
test "issue 529 fixed" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
@import("529_other_file.zig").issue529(null);
issue529(null);
}