| author | |
| committer | |
| log | ab658e32bdfa234b6c33f0718cac7a23fbd4074f |
| tree | 40878d73c0a191559605b020d20921d316189f20 |
| parent | 76311aebff0f76dba96f589438957a32c364a011 |
The Export tables should only be populated with non-internal exports.2 files changed, 14 insertions(+), 0 deletions(-)
src/Sema.zig+4| ... | ... | @@ -4321,6 +4321,10 @@ pub fn analyzeExport( |
| 4321 | 4321 | const Export = Module.Export; |
| 4322 | 4322 | const mod = sema.mod; |
| 4323 | 4323 | |
| 4324 | if (borrowed_options.linkage == .Internal) { | |
| 4325 | return; | |
| 4326 | } | |
| 4327 | ||
| 4324 | 4328 | try mod.ensureDeclAnalyzed(exported_decl_index); |
| 4325 | 4329 | const exported_decl = mod.declPtr(exported_decl_index); |
| 4326 | 4330 | // TODO run the same checks as we do for C ABI struct fields |
test/behavior/export.zig+10| ... | ... | @@ -45,3 +45,13 @@ test "exporting enum type and value" { |
| 45 | 45 | }; |
| 46 | 46 | try expect(S.e == .two); |
| 47 | 47 | } |
| 48 | ||
| 49 | test "exporting with internal linkage" { | |
| 50 | const S = struct { | |
| 51 | fn foo() callconv(.C) void {} | |
| 52 | comptime { | |
| 53 | @export(foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .Internal }); | |
| 54 | } | |
| 55 | }; | |
| 56 | S.foo(); | |
| 57 | } |