Skip to content

Commit 2ddd3ec

Browse files
authored
Merge 2025-11 LWG Motion 8
P3860R1 Proposed Resolution for NB Comment GB13-309 `atomic_ref<T>` is not convertible to `atomic_ref<const T>`
2 parents aeca00b + 1a1b3cb commit 2ddd3ec

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

source/threads.tex

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,6 +3161,8 @@
31613161

31623162
constexpr explicit atomic_ref(T&);
31633163
constexpr atomic_ref(const atomic_ref&) noexcept;
3164+
template<class U>
3165+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
31643166
atomic_ref& operator=(const atomic_ref&) = delete;
31653167

31663168
constexpr void store(value_type, memory_order = memory_order::seq_cst) const noexcept;
@@ -3313,6 +3315,24 @@
33133315
\tcode{*this} references the object referenced by \tcode{ref}.
33143316
\end{itemdescr}
33153317

3318+
\begin{itemdecl}
3319+
template<class U>
3320+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
3321+
\end{itemdecl}
3322+
3323+
\begin{itemdescr}
3324+
\pnum
3325+
\constraints
3326+
\begin{itemize}
3327+
\item \tcode{T} and \tcode{U} are similar types\iref{conv.qual}, and
3328+
\item \tcode{is_convertible_v<U*, T*>} is \tcode{true}.
3329+
\end{itemize}
3330+
3331+
\pnum
3332+
\ensures
3333+
\tcode{*this} references the object referenced by \tcode{ref}.
3334+
\end{itemdescr}
3335+
33163336
\indexlibrarymember{store}{atomic_ref}%
33173337
\indexlibrarymember{store}{atomic_ref<\placeholder{pointer-type}>}%
33183338
\indexlibrarymember{store}{atomic_ref<\placeholder{integral-type}>}%
@@ -3638,6 +3658,8 @@
36383658

36393659
constexpr explicit atomic_ref(@\placeholder{integral-type}@&);
36403660
constexpr atomic_ref(const atomic_ref&) noexcept;
3661+
template<class U>
3662+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
36413663
atomic_ref& operator=(const atomic_ref&) = delete;
36423664

36433665
constexpr void store(value_type, memory_order = memory_order::seq_cst) const noexcept;
@@ -3860,6 +3882,8 @@
38603882

38613883
constexpr explicit atomic_ref(@\placeholder{floating-point-type}@&);
38623884
constexpr atomic_ref(const atomic_ref&) noexcept;
3885+
template<class U>
3886+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
38633887
atomic_ref& operator=(const atomic_ref&) = delete;
38643888

38653889
constexpr void store(value_type,
@@ -4152,6 +4176,8 @@
41524176

41534177
constexpr explicit atomic_ref(@\placeholder{pointer-type}@&);
41544178
constexpr atomic_ref(const atomic_ref&) noexcept;
4179+
template<class U>
4180+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
41554181
atomic_ref& operator=(const atomic_ref&) = delete;
41564182

41574183
constexpr void store(value_type, memory_order = memory_order::seq_cst) const noexcept;

0 commit comments

Comments
 (0)