From e5715b4178e7c5a7e246bd8319d0043dcaa08d04 Mon Sep 17 00:00:00 2001 From: Abhinav Agarwal Date: Wed, 17 Jun 2026 08:48:25 -0700 Subject: [PATCH] [dcl.type.decltype] Fix decltype of template splice-specialization-specifier The decltype bullet for splice-expressions referred to "the type ... designated by the splice-specifier of E" for all three splice-expression productions. For a template splice-specialization-specifier whose splice-specifier designates a variable template, that splice-specifier designates the template itself, which has no type; only its specialization does. Split the bullet so the variable-template form yields the type of the specialization S, the function-template forms denote an overload set (ill-formed for decltype), and the plain splice-specifier form is unchanged, mirroring [dcl.type.splice] and [expr.prim.id.qual]. --- source/declarations.tex | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/declarations.tex b/source/declarations.tex index 627360a226..0d8bb4dce1 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -1720,9 +1720,27 @@ type of the entity named by $E$. If there is no such entity, the program is ill-formed; -\item otherwise, if $E$ is an unparenthesized \grammarterm{splice-expression}, +\item otherwise, if $E$ is an unparenthesized \grammarterm{splice-expression}: +\begin{itemize} +\item if $E$ is of the form \grammarterm{splice-specifier}, \tcode{decltype($E$)} is the type of the entity, object, or value designated by the \grammarterm{splice-specifier} of $E$; +\item otherwise, if $E$ is of the form +\tcode{template \grammarterm{splice-specialization-specifier}} and +the \grammarterm{splice-specifier} of +the \grammarterm{splice-specialization-specifier} designates +a variable template $T$, +let $S$ be the specialization of $T$ corresponding to +the template argument list of the \grammarterm{splice-specialization-specifier}; +\tcode{decltype($E$)} is the type of $S$; +\item otherwise, if $E$ is of the form +\tcode{template \grammarterm{splice-specifier}}, or +of the form \tcode{template \grammarterm{splice-specialization-specifier}} +whose \grammarterm{splice-specifier} designates a function template, +$E$ denotes an overload set\iref{expr.prim.splice} and +the program is ill-formed; +\item otherwise, the program is ill-formed; +\end{itemize} \item otherwise, if $E$ is an xvalue, \tcode{decltype($E$)} is \tcode{T\&\&}, where \tcode{T} is the type