aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-12-30 19:19:05 -0500
committerGitHub <noreply@github.com>2019-12-30 19:19:05 -0500
commit73e535e1125d76bcd4e85123defea8b76412ab09 (patch)
treee347bc78a7ea39a2009b490e3be97074d05f9fcb /test/compile_errors.zig
parentcbfd66f68a5a390abcf99e8cc6923d056ee1e4fa (diff)
parent2252951066f772ac6b77ab183ad3bc074ae8f09f (diff)
downloadzig-73e535e1125d76bcd4e85123defea8b76412ab09.tar.gz
zig-73e535e1125d76bcd4e85123defea8b76412ab09.zip
Merge pull request #3683 from Vexu/atomic-float
Support floats with some atomic operations
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 1c09ed9edf..75e88ac918 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -31,6 +31,26 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"tmp.zig:3:12: note: destination pointer requires a terminating '0' sentinel",
});
+ cases.add(
+ "cmpxchg with float",
+ \\export fn entry() void {
+ \\ var x: f32 = 0;
+ \\ _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst);
+ \\}
+ , &[_][]const u8{
+ "tmp.zig:3:22: error: expected integer, enum or pointer type, found 'f32'",
+ });
+
+ cases.add(
+ "atomicrmw with float op not .Xchg, .Add or .Sub",
+ \\export fn entry() void {
+ \\ var x: f32 = 0;
+ \\ _ = @atomicRmw(f32, &x, .And, 2, .SeqCst);
+ \\}
+ , &[_][]const u8{
+ "tmp.zig:3:29: error: @atomicRmw with float only works with .Xchg, .Add and .Sub",
+ });
+
cases.add("intToPtr with misaligned address",
\\pub fn main() void {
\\ var y = @intToPtr([*]align(4) u8, 5);