5
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
- //
8
+
9
9
// UNSUPPORTED: c++03, c++11, c++14
10
+ // XFAIL: LIBCXX-PICOLIBC-FIXME
10
11
11
12
// <atomic>
12
13
//
15
16
//
16
17
// static constexpr bool is_always_lock_free;
17
18
19
+ // Ignore diagnostic about vector types changing the ABI on some targets, since
20
+ // that is irrelevant for this test.
21
+ // ADDITIONAL_COMPILE_FLAGS: -Wno-psabi
22
+
18
23
#include < atomic>
19
24
#include < cassert>
20
25
#include < cstddef>
@@ -26,7 +31,8 @@ template <typename T>
26
31
void check_always_lock_free (std::atomic<T> const & a) {
27
32
using InfoT = LockFreeStatusInfo<T>;
28
33
29
- constexpr std::same_as<const bool > decltype (auto ) is_always_lock_free = std::atomic<T>::is_always_lock_free;
34
+ constexpr auto is_always_lock_free = std::atomic<T>::is_always_lock_free;
35
+ ASSERT_SAME_TYPE (decltype (is_always_lock_free), bool const );
30
36
31
37
// If we know the status of T for sure, validate the exact result of the function.
32
38
if constexpr (InfoT::status_known) {
@@ -44,7 +50,8 @@ void check_always_lock_free(std::atomic<T> const& a) {
44
50
45
51
// In all cases, also sanity-check it based on the implication always-lock-free => lock-free.
46
52
if (is_always_lock_free) {
47
- std::same_as<bool > decltype (auto ) is_lock_free = a.is_lock_free ();
53
+ auto is_lock_free = a.is_lock_free ();
54
+ ASSERT_SAME_TYPE (decltype (is_always_lock_free), bool const );
48
55
assert (is_lock_free);
49
56
}
50
57
ASSERT_NOEXCEPT (a.is_lock_free ());
0 commit comments