1#todo "passes, but prints errors"
2#skip x86_64-linux-none-baseline-whole-selfhosted-new-nopic
3#skip x86_64-linux-none-baseline-whole-selfhosted-new-pic
4#skip x86_64-linux-none-baseline-incremental-selfhosted-new-nopic
5#skip x86_64-linux-none-baseline-incremental-selfhosted-new-pic
6
7#exe {
8--name enums
9-Mroot=enums.zig
10#}
11
12#write enums.zig {
13const Enums = struct {
14 const Zero = enum(u4) { _ };
15 const One = enum { first };
16 const Two = enum(i32) { first, second, _ };
17 const Three = enum { first, second, third };
18
19 zero: Zero = @fromBackingInt(13),
20 one: One = .first,
21 two: Two = @fromBackingInt(-1234),
22 three: Three = .second,
23};
24fn testEnums(enums: Enums) void {
25 _ = enums;
26}
27pub fn main() void {
28 testEnums(.{});
29}
30#}
31#update
32#check lldb {
33(lldb) breakpoint set --file enums.zig --source-pattern-regexp '_ = enums;'
34Breakpoint 1: where = enums`enums.testEnums + #... at enums.zig:14:1, address = 0x#...
35(lldb) process launch
36Process #... launched: '#.../enums' (#...)
37Process #... stopped
38* thread #1, name = 'enums', stop reason = breakpoint 1.1
39 frame #0: enums`enums.testEnums(enums=(.zero = @fromBackingInt(13), .one = .first, .two = @fromBackingInt(-1234), .three = .second)) at enums.zig:14:1
40(lldb) expression --show-types -- Enums
41(type) $0 = struct {
42 (type) Zero = enum {}
43 (type) One = enum {
44 (root.enums.Enums.One) first = .first
45 }
46 (type) Two = enum {
47 (root.enums.Enums.Two) first = .first
48 (root.enums.Enums.Two) second = .second
49 }
50 (type) Three = enum {
51 (root.enums.Enums.Three) first = .first
52 (root.enums.Enums.Three) second = .second
53 (root.enums.Enums.Three) third = .third
54 }
55}
56(lldb) frame variable --show-all-children --show-types -- enums
57(root.enums.Enums) enums = {
58 (root.enums.Enums.Zero) .zero = @fromBackingInt(13)
59 (root.enums.Enums.One) .one = .first
60 (root.enums.Enums.Two) .two = @fromBackingInt(-1234)
61 (root.enums.Enums.Three) .three = .second
62}
63(lldb) breakpoint delete --force 1
641 breakpoints deleted; 0 breakpoint locations disabled.
65#}