mirror of
https://github.com/ziglang/zig.git
synced 2025-12-21 13:43:10 +00:00
Sema: fix export with Internal linkage
The Export tables should only be populated with non-internal exports.
This commit is contained in:
parent
76311aebff
commit
ab658e32bd
@ -4321,6 +4321,10 @@ pub fn analyzeExport(
|
|||||||
const Export = Module.Export;
|
const Export = Module.Export;
|
||||||
const mod = sema.mod;
|
const mod = sema.mod;
|
||||||
|
|
||||||
|
if (borrowed_options.linkage == .Internal) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try mod.ensureDeclAnalyzed(exported_decl_index);
|
try mod.ensureDeclAnalyzed(exported_decl_index);
|
||||||
const exported_decl = mod.declPtr(exported_decl_index);
|
const exported_decl = mod.declPtr(exported_decl_index);
|
||||||
// TODO run the same checks as we do for C ABI struct fields
|
// TODO run the same checks as we do for C ABI struct fields
|
||||||
|
|||||||
@ -45,3 +45,13 @@ test "exporting enum type and value" {
|
|||||||
};
|
};
|
||||||
try expect(S.e == .two);
|
try expect(S.e == .two);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "exporting with internal linkage" {
|
||||||
|
const S = struct {
|
||||||
|
fn foo() callconv(.C) void {}
|
||||||
|
comptime {
|
||||||
|
@export(foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .Internal });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
S.foo();
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user