-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.14.0-dev.2540+f857bf72e
Steps to Reproduce and Observed Behavior
Create file test.zig with the following contents:
const std = @import("std");
test {
var value = @as(u5, 0);
const Foo = packed struct(u7) {
val2: u7,
};
const foo: Foo = .{ .val2 = value };
// if `comptime` is removed here, the segfault goes away
std.debug.print("{}", .{comptime foo});
}
Observe segfault:
$ zig test test.zig
Segmentation fault
Expected Behavior
Not sure, when I remove the comptime I get the following output:
test.zig:4:9: error: local variable is never mutated
var value = @as(u5, 0);
^~~~~
test.zig:4:9: note: consider using 'const'
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.