We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Zig from zig-windows-x86_64-0.8.0-dev.1431+c760532be.zip on Windows 10.
const std = @import("std"); pub fn main() void { const b1 = Baz{ .quux = 1 }; std.debug.print("1: {}\n", .{Foo{ .baz = b1 }}); const b2 = Baz.init(2); std.debug.print("2: {}\n", .{Foo{ .baz = b2 }}); } const Foo = union(enum) { bar: i32, baz: Baz, }; const Baz = struct { quux: i32, pub fn init(the_quux: i32) @This() { return .{ .quux = the_quux }; } };
Output:
1: Foo{ .baz = Baz{ .quux = 1 } } Segmentation fault at address 0x7ff6afd7c5e8 C:\devel\Zig\projects\playground\union_segfault_repro\src\main.zig:8:39: 0x7ff6afd430ce in main (union_segfault_repro.obj) std.debug.print("2: {}\n", .{Foo{ .baz = b2 }}); ^ C:\devel\Zig\zig-windows-x86_64\lib\zig\std\start.zig:174:65: 0x7ff6afd41a87 in std.start.WinStartup (union_segfault_repro.obj) std.os.windows.kernel32.ExitProcess(initEventLoopAndCallMain()); ^
The text was updated successfully, but these errors were encountered:
Duplicate of #3915.
Sorry, something went wrong.
No branches or pull requests
Using Zig from zig-windows-x86_64-0.8.0-dev.1431+c760532be.zip on Windows 10.
Output:
The text was updated successfully, but these errors were encountered: