master
 1pub export fn entry() void {
 2    const S = struct {
 3        comptime a: [2]u32 = [2]u32{ 1, 2 },
 4    };
 5    var s: S = .{};
 6    s.a = [2]u32{ 2, 2 };
 7}
 8pub export fn entry1() void {
 9    const T = struct { a: u32, b: u32 };
10    const S = struct {
11        comptime a: T = T{ .a = 1, .b = 2 },
12    };
13    var s: S = .{};
14    s.a = T{ .a = 2, .b = 2 };
15}
16pub export fn entry2() void {
17    var list = .{ 1, 2, 3 };
18    var list2 = @TypeOf(list){ .@"0" = 1, .@"1" = 2, .@"2" = 3 };
19    var list3 = @TypeOf(list){ 1, 2, 4 };
20    _ = &list;
21    _ = &list2;
22    _ = &list3;
23}
24pub export fn entry3() void {
25    const U = struct {
26        comptime foo: u32 = 1,
27        bar: u32,
28        fn qux(x: @This()) void {
29            _ = x;
30        }
31    };
32    _ = U.qux(U{ .foo = 2, .bar = 2 });
33}
34pub export fn entry4() void {
35    const U = struct {
36        comptime foo: u32 = 1,
37        bar: u32,
38        fn qux(x: @This()) void {
39            _ = x;
40        }
41    };
42    _ = U.qux(.{ .foo = 2, .bar = 2 });
43}
44pub export fn entry5() void {
45    comptime var y = .{ 1, 2 };
46    y = .{ 3, 4 };
47}
48pub export fn entry6() void {
49    var x: u32 = 15;
50    _ = &x;
51    const T = @TypeOf(.{ @as(i32, -1234), @as(u32, 5678), x });
52    const S = struct {
53        fn foo(_: T) void {}
54    };
55    _ = S.foo(.{ -1234, 5679, x });
56}
57pub export fn entry7() void {
58    const State = struct {
59        comptime id: bool = true,
60        fn init(comptime id: bool) @This() {
61            return @This(){ .id = id };
62        }
63    };
64    _ = State.init(false);
65}
66pub export fn entry8() void {
67    const list1 = .{ "sss", 1, 2, 3 };
68    const list2 = @TypeOf(list1){ .@"0" = "xxx", .@"1" = 4, .@"2" = 5, .@"3" = 6 };
69    _ = list2;
70}
71
72// error
73//
74// :6:9: error: value stored in comptime field does not match the default value of the field
75// :14:9: error: value stored in comptime field does not match the default value of the field
76// :19:38: error: value stored in comptime field does not match the default value of the field
77// :32:19: error: value stored in comptime field does not match the default value of the field
78// :26:29: note: default value set here
79// :42:19: error: value stored in comptime field does not match the default value of the field
80// :36:29: note: default value set here
81// :46:12: error: value stored in comptime field does not match the default value of the field
82// :55:25: error: value stored in comptime field does not match the default value of the field
83// :61:30: error: value stored in comptime field does not match the default value of the field
84// :59:29: note: default value set here
85// :68:36: error: value stored in comptime field does not match the default value of the field