| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03 |
| 10 | |
| 11 | // <atomic> |
| 12 | |
| 13 | #include <atomic> |
| 14 | #include <type_traits> |
| 15 | #include <cassert> |
| 16 | |
| 17 | #include "test_macros.h" |
| 18 | #include "atomic_helpers.h" |
| 19 | |
| 20 | template <class Tp> |
| 21 | struct CheckStandardLayout { |
| 22 | void operator()() const { |
| 23 | typedef std::atomic<Tp> Atomic; |
| 24 | static_assert(std::is_standard_layout<Atomic>::value, "" ); |
| 25 | } |
| 26 | }; |
| 27 | |
| 28 | void tests() { |
| 29 | TestEachIntegralType<CheckStandardLayout>()(); |
| 30 | TestEachFloatingPointType<CheckStandardLayout>()(); |
| 31 | TestEachPointerType<CheckStandardLayout>()(); |
| 32 | } |
| 33 | |