From 308a12552d9e4b0a314f3cdfd244fa57bab0daac Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Fri, 19 Jun 2026 15:40:24 -0700 Subject: [PATCH] P2414R12 Pointer lifetime-end zap proposed solutions [conv.lval]p3.5 [expr.assign]p2 Replaced non-existent reference "6.7.5.5.3" with [basic.compound] --- source/expressions.tex | 29 ++++++++++++++++++++++++----- source/threads.tex | 16 ++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 72f77d87bb..354c0ba9b6 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -700,11 +700,20 @@ \item Otherwise, the object indicated by the glvalue is read\iref{defns.access}. Let \tcode{V} be the value contained in the object. -If \tcode{T} is an integer type, -the prvalue result is -the value of type \tcode{T} congruent\iref{basic.fundamental} to \tcode{V}, and +The prvalue result is +\begin{itemize} +\item +the value of type \tcode{T} congruent\iref{basic.fundamental} to \tcode{V} +if \tcode{T} is an integer type, +\item +the result of \tcode{reinterpret_cast(reinterpret_cast(V))} +if \tcode{T} is volatile-qualified +and \tcode{V} is a pointer value +that is not valid in the context of the evaluation\iref{basic.compound}, and +\item \tcode{V} otherwise. \end{itemize} +\end{itemize} \pnum \begin{note} @@ -8248,9 +8257,19 @@ let \tcode{V} be the result of the right operand; the object referred to by the left operand is modified\iref{defns.access} by replacing its value -with \tcode{V} or, +with +\begin{itemize} +\item +the value congruent\iref{basic.fundamental} to \tcode{V} if the object is of integer type, -with the value congruent\iref{basic.fundamental} to \tcode{V}. +\item +the result of \tcode{reinterpret_cast(reinterpret_cast(V))} +if the left operand is a volatile-qualified glvalue of pointer type \tcode{T} +and \tcode{V} is a pointer value +that is not valid in the context of the evaluation\iref{basic.compound}, and +\item +\tcode{V} otherwise. +\end{itemize} \pnum \indextext{assignment!conversion by}% diff --git a/source/threads.tex b/source/threads.tex index b3a041cf6f..044d03c8a2 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -4170,6 +4170,14 @@ the specialization \tcode{atomic_ref<\placeholder{pointer-type}>} provides additional atomic operations appropriate to pointer types. +\pnum +Except during constant evaluation, +when an operation on an atomic pointer +would otherwise result in a pointer value \tcode{p} +that is not valid in the context of the evaluation\iref{basic.compound}, +that result instead is +\tcode{reinterpret_cast(reinterpret_cast(p))}. + \pnum The program is ill-formed if \tcode{is_always_lock_free} is \tcode{false} and @@ -5818,6 +5826,14 @@ Specializations of this partial specialization are standard-layout structs. They each have a trivial destructor. +\pnum +Except during constant evaluation, +when an operation on an atomic pointer +would otherwise result in a pointer value \tcode{p} +that is not valid in the context of the evaluation\iref{basic.compound}, +that result instead is +\tcode{reinterpret_cast(reinterpret_cast(p))}. + \pnum Descriptions are provided below only for members that differ from the primary template.