aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-05-04 18:19:49 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-05-04 18:19:49 -0700
commitc95e49785772a54916418630fbc7283791a4aa72 (patch)
tree4097d9cfef1b2ce5209410310480fad730f5a5ec /test/run_tests.cpp
parentf2bc5ccbc2f322b625719d374bbb09a4335c1bd1 (diff)
downloadzig-c95e49785772a54916418630fbc7283791a4aa72.tar.gz
zig-c95e49785772a54916418630fbc7283791a4aa72.zip
add cmpxchg builtin function
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 40b0824092..9d5861d9e5 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1295,8 +1295,20 @@ fn foo() {
#static_eval_enable(false)
fn bar() -> i32 { 2 }
)SOURCE", 1, ".tmp_source.zig:3:15: error: unable to infer expression type");
+
+ add_compile_fail_case("atomic orderings of cmpxchg", R"SOURCE(
+fn f() {
+ var x: i32 = 1234;
+ while (!@cmpxchg(&x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}
+ while (!@cmpxchg(&x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}
+}
+ )SOURCE", 2,
+ ".tmp_source.zig:4:72: error: failure atomic ordering must be no stricter than success",
+ ".tmp_source.zig:5:49: error: success atomic ordering must be Monotonic or stricter");
}
+//////////////////////////////////////////////////////////////////////////////
+
static void add_debug_safety_test_cases(void) {
add_debug_safety_case("out of bounds slice access", R"SOURCE(
pub fn main(args: [][]u8) -> %void {