Commit 8b66443d50
Changed files (4)
src
codegen
test
src/codegen/llvm.zig
@@ -2335,6 +2335,7 @@ pub const Object = struct {
const stack_trace_decl = builtin_namespace.decls
.getKeyAdapted(stack_trace_str, Module.DeclAdapter{ .mod = mod }).?;
+ mod.ensureDeclAnalyzed(stack_trace_decl) catch unreachable;
return mod.declPtr(stack_trace_decl).val.toType(undefined);
}
};
test/standalone/issue_13030/build.zig
@@ -0,0 +1,18 @@
+const std = @import("std");
+const builtin = @import("builtin");
+const Builder = std.build.Builder;
+const CrossTarget = std.zig.CrossTarget;
+
+pub fn build(b: *Builder) void {
+ const mode = b.standardReleaseOptions();
+ const target = b.standardTargetOptions(.{});
+
+ const obj = b.addObject("main", "main.zig");
+ obj.setBuildMode(mode);
+
+ obj.setTarget(target);
+ b.default_step.dependOn(&obj.step);
+
+ const test_step = b.step("test", "Test the program");
+ test_step.dependOn(&obj.step);
+}
test/standalone/issue_13030/main.zig
@@ -0,0 +1,8 @@
+const std = @import("std");
+fn a() error{}!void {}
+fn b() std.meta.FnPtr(fn () error{}!void) {
+ return &a;
+}
+export fn c() void {
+ _ = b();
+}
test/standalone.zig
@@ -97,4 +97,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void {
// Disabled due to tripping LLVM 13 assertion:
// https://github.com/ziglang/zig/issues/12015
//cases.add("tools/update_spirv_features.zig");
+
+ cases.addBuildFile("test/standalone/issue_13030/build.zig", .{ .build_modes = true });
}