Skip to content

Commit 5f95fad

Browse files
committed
P3860R1 Proposed Resolution for NB Comment GB13-309 atomic_ref<T> is not convertible to atomic_ref<const T>
Fixes NB GB 13-309 (C++26 CD).
1 parent 5e49eff commit 5f95fad

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;
@@ -3317,6 +3319,24 @@
33173319
\tcode{*this} references the object referenced by \tcode{ref}.
33183320
\end{itemdescr}
33193321

3322+
\begin{itemdecl}
3323+
template<class U>
3324+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
3325+
\end{itemdecl}
3326+
3327+
\begin{itemdescr}
3328+
\pnum
3329+
\constraints
3330+
\begin{itemize}
3331+
\item \tcode{T} and \tcode{U} are similar types\iref{conv.qual}, and
3332+
\item \tcode{is_convertible_v<U*, T*>} is \tcode{true}.
3333+
\end{itemize}
3334+
3335+
\pnum
3336+
\ensures
3337+
\tcode{*this} references the object referenced by \tcode{ref}.
3338+
\end{itemdescr}
3339+
33203340
\indexlibrarymember{store}{atomic_ref}%
33213341
\indexlibrarymember{store}{atomic_ref<\placeholder{pointer-type}>}%
33223342
\indexlibrarymember{store}{atomic_ref<\placeholder{integral-type}>}%
@@ -3642,6 +3662,8 @@
36423662

36433663
constexpr explicit atomic_ref(@\placeholder{integral-type}@&);
36443664
constexpr atomic_ref(const atomic_ref&) noexcept;
3665+
template<class U>
3666+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
36453667
atomic_ref& operator=(const atomic_ref&) = delete;
36463668

36473669
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,
@@ -4148,6 +4172,8 @@
41484172

41494173
constexpr explicit atomic_ref(@\placeholder{pointer-type}@&);
41504174
constexpr atomic_ref(const atomic_ref&) noexcept;
4175+
template<class U>
4176+
constexpr atomic_ref(const atomic_ref<U>&) noexcept;
41514177
atomic_ref& operator=(const atomic_ref&) = delete;
41524178

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

0 commit comments

Comments
 (0)