diff options
Diffstat (limited to 'test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp')
-rw-r--r-- | test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp index 66918c71f1f6..e7b8e64b434f 100644 --- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp +++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads -// ... assertion fails line 34 +// ... assertion fails line 35 // <atomic> @@ -24,10 +24,11 @@ #include <type_traits> #include <cassert> +#include "atomic_helpers.h" + template <class T> -void -test() -{ +struct TestFn { + void operator()() const { typedef std::atomic<T> A; A t; std::atomic_init(&t, T(1)); @@ -35,37 +36,10 @@ test() volatile A vt; std::atomic_init(&vt, T(2)); assert(std::atomic_load(&vt) == T(2)); -} - -struct A -{ - int i; - - explicit A(int d = 0) noexcept {i=d;} - - friend bool operator==(const A& x, const A& y) - {return x.i == y.i;} + } }; int main() { - test<A>(); - test<char>(); - test<signed char>(); - test<unsigned char>(); - test<short>(); - test<unsigned short>(); - test<int>(); - test<unsigned int>(); - test<long>(); - test<unsigned long>(); - test<long long>(); - test<unsigned long long>(); - test<wchar_t>(); -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - test<char16_t>(); - test<char32_t>(); -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - test<int*>(); - test<const int*>(); + TestEachAtomicType<TestFn>()(); } |