From fc9611ce100ffaaedf3cb6f7df16c429c5ffaf25 Mon Sep 17 00:00:00 2001 From: Abhinav Agarwal Date: Fri, 3 Jul 2026 10:36:36 -0700 Subject: [PATCH 1/2] [expr.prim.splice] Apply contract constification to variable templates --- source/expressions.tex | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/source/expressions.tex b/source/expressions.tex index 72f77d87bb..4c848c4f73 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -3659,7 +3659,7 @@ \end{note} \pnum -For a \grammarterm{splice-expression} of +For a \grammarterm{splice-expression} $E$ of the form \tcode{template \grammarterm{splice-specialization-specifier}}, the \grammarterm{splice-specifier} of the \grammarterm{splice-specialization-specifier} @@ -3676,8 +3676,20 @@ Otherwise, if $T$ is a variable template, let $S$ be the specialization of $T$ corresponding to the template argument list of the \grammarterm{splice-specialization-specifier}. -The expression is an lvalue referring to -the object associated with $S$ and has the same type as that of $S$. +The expression $E$ is an lvalue referring to the object or function $X$ +associated with or referenced by $S$. +If $E$ appears in the predicate of a contract assertion $C$\iref{basic.contract} +and $S$ is +\begin{itemize} +\item +a variable declared outside of $C$ +of object type \tcode{U}, or +\item +a variable declared outside of $C$ +of type ``reference to \tcode{U}'', +\end{itemize} +then the type of $E$ is \tcode{const U}, +otherwise $E$ has the same type as that of $S$. \item Otherwise, the expression is ill-formed. \end{itemize} From eb8ba257d10c24d7e19de11ef7568b26305bda15 Mon Sep 17 00:00:00 2001 From: Abhinav Agarwal Date: Fri, 3 Jul 2026 10:48:41 -0700 Subject: [PATCH 2/2] [expr.prim.splice] Clarify variable template wording --- source/expressions.tex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/expressions.tex b/source/expressions.tex index 4c848c4f73..ebb6515b40 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -3676,7 +3676,7 @@ Otherwise, if $T$ is a variable template, let $S$ be the specialization of $T$ corresponding to the template argument list of the \grammarterm{splice-specialization-specifier}. -The expression $E$ is an lvalue referring to the object or function $X$ +The expression $E$ is an lvalue referring to the object or function associated with or referenced by $S$. If $E$ appears in the predicate of a contract assertion $C$\iref{basic.contract} and $S$ is @@ -3690,6 +3690,11 @@ \end{itemize} then the type of $E$ is \tcode{const U}, otherwise $E$ has the same type as that of $S$. +\begin{note} +The type of a \grammarterm{splice-expression} +designating a variable template specialization of reference type +will be adjusted to a non-reference type\iref{expr.type}. +\end{note} \item Otherwise, the expression is ill-formed. \end{itemize}