atomic_ref<T>
is not convertible to atomic_ref<const T>
Document #: | P3860R0 [Latest] [Status] |
Date: | 2025-10-04 |
Project: | Programming Language C++ |
Audience: |
LEWG, LWG |
Reply-to: |
Hui Xie <hui.xie1990@gmail.com> Damien Lebrun-Grandié <lebrungrandt@ornl.gov> |
This paper proposes a converting constructor for
atomic_ref
as the resolution for UK
NB Comment GB13-309.
The UK NB Comment GB13-309 pointed out that atomic_ref<T>
is not convertible to atomic_ref<const T>
.
[P3323R1] added cv qualifiers to
atomic
and
atomic_ref
. However, the conversion
constructor of atomic_ref
between
different cv qualifiers is overlooked.
Change [atomics.ref.generic.general] as follows:
constexpr explicit atomic_ref(T&);
constexpr atomic_ref(const atomic_ref&) noexcept;
template <class U>
constexpr atomic_ref(const atomic_ref<U>&);
Add a new entry to [atomics.ref.ops] after paragraph 8:
template <class U> constexpr atomic_ref(const atomic_ref<U>& ref);
9 Contraints:
10
Postconditions: *this
references the object referenced by
ref
.
[P3323R1] is currently being implemented in libc++ and adding the proposed constructor is under way.
[P3323R1] does not seem to mention Feature Test Macro