diff options
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index e7fddace91..6c3a6e976d 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2051,4 +2051,14 @@ pub fn addCases(cases: &tests.CompileErrorContext) { , ".tmp_source.zig:2:35: error: expected type 'fn() align 8 -> i32', found 'fn() align 4 -> i32'"); + cases.add("passing a not-aligned-enough pointer to cmpxchg", + \\const AtomicOrder = @import("builtin").AtomicOrder; + \\export fn entry() -> bool { + \\ var x: i32 align 1 = 1234; + \\ while (!@cmpxchg(&x, 1234, 5678, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) {} + \\ return x == 5678; + \\} + , + ".tmp_source.zig:4:23: error: expected pointer alignment of at least 4, found 1"); + } |
