diff options
| author | Vexu <git@vexu.eu> | 2020-03-10 22:46:19 +0200 |
|---|---|---|
| committer | Vexu <git@vexu.eu> | 2020-03-10 22:54:47 +0200 |
| commit | ee5b00a8b90ef375d0cd4432d31e3a4ed0b6f632 (patch) | |
| tree | c775663438485092fca336a68a5bcbbc047de818 /test/compile_errors.zig | |
| parent | 8dc188ebe06b5b78dcead521561858fc27e25204 (diff) | |
| download | zig-ee5b00a8b90ef375d0cd4432d31e3a4ed0b6f632.tar.gz zig-ee5b00a8b90ef375d0cd4432d31e3a4ed0b6f632.zip | |
use atomic bools in std lib
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index a2d4e8ac23..28529b3f57 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,15 @@ const tests = @import("tests.zig"); const std = @import("std"); pub fn addCases(cases: *tests.CompileErrorContext) void { + cases.add("atomicrmw with bool op not .Xchg", + \\export fn entry() void { + \\ var x = false; + \\ _ = @atomicRmw(bool, &x, .Add, true, .SeqCst); + \\} + , &[_][]const u8{ + "tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg", + }); + cases.addTest("combination of noasync and async", \\export fn entry() void { \\ noasync { @@ -325,7 +334,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ _ = @atomicRmw(f32, &x, .And, 2, .SeqCst); \\} , &[_][]const u8{ - "tmp.zig:3:29: error: @atomicRmw with float only works with .Xchg, .Add and .Sub", + "tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub", }); cases.add("intToPtr with misaligned address", @@ -542,7 +551,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ _ = @atomicRmw(E, &x, .Add, .b, .SeqCst); \\} , &[_][]const u8{ - "tmp.zig:9:27: error: @atomicRmw on enum only works with .Xchg", + "tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg", }); cases.add("disallow coercion from non-null-terminated pointer to null-terminated pointer", |
