| 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, c++11, c++14, c++17 |
| 10 | |
| 11 | // using value_type = floating-point-type; |
| 12 | // using difference_type = value_type; |
| 13 | // The atomic floating-point specializations are standard-layout structs. They each have a trivial destructor. |
| 14 | |
| 15 | #include <atomic> |
| 16 | #include <type_traits> |
| 17 | |
| 18 | template <class T> |
| 19 | void test() { |
| 20 | // LWG 3045. atomic<floating-point> doesn't have value_type or difference_type |
| 21 | // https://cplusplus.github.io/LWG/issue3045 |
| 22 | static_assert(std::is_same_v<typename std::atomic<T>::value_type, T>); |
| 23 | static_assert(std::is_same_v<typename std::atomic<T>::difference_type, T>); |
| 24 | |
| 25 | static_assert(std::is_standard_layout_v<std::atomic<T>>); |
| 26 | static_assert(std::is_trivially_destructible_v<std::atomic<T>>); |
| 27 | } |
| 28 | |
| 29 | template void test<float>(); |
| 30 | template void test<double>(); |
| 31 | template void test<long double>(); |
| 32 | |