summaryrefslogtreecommitdiff
path: root/test/std/atomics/atomics.flag/clear.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/atomics/atomics.flag/clear.pass.cpp')
-rw-r--r--test/std/atomics/atomics.flag/clear.pass.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/test/std/atomics/atomics.flag/clear.pass.cpp b/test/std/atomics/atomics.flag/clear.pass.cpp
index ea5ae45ae99a0..255af8f176ea6 100644
--- a/test/std/atomics/atomics.flag/clear.pass.cpp
+++ b/test/std/atomics/atomics.flag/clear.pass.cpp
@@ -22,50 +22,58 @@
int main()
{
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f; // uninitialized
+ f.clear();
+ assert(f.test_and_set() == 0);
f.clear();
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ f.clear(std::memory_order_relaxed);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ f.clear(std::memory_order_release);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f(false);
- f.test_and_set();
+ std::atomic_flag f;
+ f.clear(std::memory_order_seq_cst);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear();
+ assert(f.test_and_set() == 0);
f.clear();
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear(std::memory_order_relaxed);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear(std::memory_order_release);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f(false);
- f.test_and_set();
+ volatile std::atomic_flag f;
+ f.clear(std::memory_order_seq_cst);
+ assert(f.test_and_set() == 0);
f.clear(std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}