diff options
| author | Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com> | 2023-11-27 15:35:29 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-27 12:35:29 +0000 |
| commit | 7fbbeae617ad9c30605a78377888c284e5d9ccdc (patch) | |
| tree | 3e56b1535d3930ff7cb621630c64008ceb42261d /test/behavior/enum.zig | |
| parent | 89572c63424eb8d9da90f2676b55c660ece57688 (diff) | |
| download | zig-7fbbeae617ad9c30605a78377888c284e5d9ccdc.tar.gz zig-7fbbeae617ad9c30605a78377888c284e5d9ccdc.zip | |
value: handle lazy_align and lazy_size in writeToPackedMemory
Diffstat (limited to 'test/behavior/enum.zig')
| -rw-r--r-- | test/behavior/enum.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig index d203476afc..6c111c3751 100644 --- a/test/behavior/enum.zig +++ b/test/behavior/enum.zig @@ -1225,3 +1225,13 @@ test "auto-numbered enum with signed tag type" { try std.testing.expectEqualStrings("a", @tagName(E.a)); try std.testing.expectEqualStrings("b", @tagName(E.b)); } + +test "lazy initialized field" { + try std.testing.expectEqual(@as(u8, @alignOf(struct {})), getLazyInitialized(.a)); +} + +fn getLazyInitialized(param: enum(u8) { + a = @bitCast(packed struct(u8) { a: u8 }{ .a = @alignOf(struct {}) }), +}) u8 { + return @intFromEnum(param); +} |
