Open Beyley opened 1 year ago
Narrowed it down, its failing to generate a compile error, this line should not be a reference to client
, it should just be client
Here is a cut down repo
const std = @import("std");
const Client = struct {};
pub fn sendPackets(_: *Client, _: anytype) void {}
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var allocator = gpa.allocator();
var thread_pool: std.Thread.Pool = undefined;
try thread_pool.init(.{
.allocator = allocator,
});
var client = try allocator.create(Client);
try thread_pool.spawn(sendPackets, .{
&client,
.{},
});
}
@Beyley, was the example supposed to crash the compiler?
I tried with the latest compiler and got a compiler error.
@perillo can you post the compiler error? if it's a compiler error then we can close this.
Zig Version
0.11.0-dev.4282+0f21d3d4d
Steps to Reproduce and Observed Behavior
Clone this repo (branch segfault-compiler) run
zig build
, you will receive a segfault in the build-exe command that followsThis only started after this line of code was added
I tried to reproduce with a smaller sample of code, but was unable
Expected Behavior
Compiler should run, and an executable should be output