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 < concepts>
@@ -27,7 +32,8 @@ template <typename T>
27
32
void check_always_lock_free (std::atomic<T> const & a) {
28
33
using InfoT = LockFreeStatusInfo<T>;
29
34
30
- constexpr std::same_as<const bool > decltype (auto ) is_always_lock_free = std::atomic<T>::is_always_lock_free;
35
+ constexpr auto is_always_lock_free = std::atomic<T>::is_always_lock_free;
36
+ ASSERT_SAME_TYPE (decltype (is_always_lock_free), bool const );
31
37
32
38
// If we know the status of T for sure, validate the exact result of the function.
33
39
if constexpr (InfoT::status_known) {
@@ -45,7 +51,8 @@ void check_always_lock_free(std::atomic<T> const& a) {
45
51
46
52
// In all cases, also sanity-check it based on the implication always-lock-free => lock-free.
47
53
if (is_always_lock_free) {
48
- std::same_as<bool > decltype (auto ) is_lock_free = a.is_lock_free ();
54
+ auto is_lock_free = a.is_lock_free ();
55
+ ASSERT_SAME_TYPE (decltype (is_always_lock_free), bool const );
49
56
assert (is_lock_free);
50
57
}
51
58
ASSERT_NOEXCEPT (a.is_lock_free ());
0 commit comments