diff options
Diffstat (limited to 'test/libcxx/atomics/atomics.flag')
-rw-r--r-- | test/libcxx/atomics/atomics.flag/init_bool.pass.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp b/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp new file mode 100644 index 000000000000..d7b172cd1212 --- /dev/null +++ b/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// <atomic> + +// struct atomic_flag + +// TESTING EXTENSION atomic_flag(bool) + +#include <atomic> +#include <cassert> + +int main() +{ + { + std::atomic_flag f(false); + assert(f.test_and_set() == 0); + } + { + std::atomic_flag f(true); + assert(f.test_and_set() == 1); + } +} |