| ... | @@ -5,14 +5,27 @@ export fn float() void { | ... | @@ -5,14 +5,27 @@ export fn float() void { |
| 5 | | 5 | |
| 6 | const NormalStruct = struct { x: u32 }; | 6 | const NormalStruct = struct { x: u32 }; |
| 7 | export fn normalStruct() void { | 7 | export fn normalStruct() void { |
| 8 | var x: NormalStruct = 0; | 8 | var x: NormalStruct = .{ .x = 0 }; |
| 9 | _ = @cmpxchgWeak(NormalStruct, &x, .{ .x = 1 }, .{ .x = 2 }, .seq_cst, .seq_cst); | 9 | _ = @cmpxchgWeak(NormalStruct, &x, .{ .x = 1 }, .{ .x = 2 }, .seq_cst, .seq_cst); |
| 10 | } | 10 | } |
| 11 | | 11 | |
| | 12 | export fn anyError() void { |
| | 13 | var x: anyerror = error.A; |
| | 14 | _ = @cmpxchgWeak(anyerror, &x, error.A, error.B, .seq_cst, .seq_cst); |
| | 15 | } |
| | 16 | |
| | 17 | const ErrorSet = error{ A, B }; |
| | 18 | export fn errorSet() void { |
| | 19 | var x: ErrorSet = error.A; |
| | 20 | _ = @cmpxchgWeak(ErrorSet, &x, error.A, error.B, .seq_cst, .seq_cst); |
| | 21 | } |
| | 22 | |
| 12 | // error | 23 | // error |
| 13 | // backend=stage2 | 24 | // backend=stage2 |
| 14 | // target=native | 25 | // target=native |
| 15 | // | 26 | // |
| 16 | // :3:22: error: expected bool, integer, enum, packed struct, or pointer type; found 'f32' | 27 | // :3:22: error: expected bool, integer, enum, packed struct, or pointer type; found 'f32' |
| 17 | // :8:27: error: expected type 'tmp.NormalStruct', found 'comptime_int' | 28 | // :9:22: error: expected bool, integer, float, enum, packed struct, or pointer type; found 'tmp.NormalStruct' |
| 18 | // :6:22: note: struct declared here | 29 | // :6:22: note: struct declared here |
| | 30 | // :14:22: error: expected bool, integer, float, enum, packed struct, or pointer type; found 'anyerror' |
| | 31 | // :20:22: error: expected bool, integer, float, enum, packed struct, or pointer type; found 'error{A,B}' |