diff --git a/source/declarations.tex b/source/declarations.tex index 42027658b5..4f0109952f 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -1444,8 +1444,14 @@ if any, shall be non-dependent and the \grammarterm{template-name} or \grammarterm{splice-specifier} shall designate a deducible template. -A \defnadj{deducible}{template} is either a class template or -is an alias template whose \grammarterm{defining-type-id} is of the form +A \defnadj{deducible}{template} is +\begin{itemize} +\item +a class template, +\item +a type template template parameter, or +\item +an alias template \tcode{A} whose \grammarterm{defining-type-id} is of the form \begin{ncsimplebnf} \opt{\keyword{typename}} \opt{nested-name-specifier} \opt{\keyword{template}} simple-template-id @@ -1453,7 +1459,9 @@ where the \grammarterm{nested-name-specifier} (if any) is non-dependent and the \grammarterm{template-name} of the \grammarterm{simple-template-id} -names a deducible template. +names a deducible template +other than a type template template parameter of \tcode{A}. +\end{itemize} \begin{note} An injected-class-name is never interpreted as a \grammarterm{template-name} in contexts where class template argument deduction would be performed\iref{temp.local}. diff --git a/source/overloading.tex b/source/overloading.tex index fe6c4d0852..e069f0bf3b 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -1431,6 +1431,20 @@ \end{codeblock} \end{example} +\pnum +When resolving a placeholder for a deduced class type +where the \grammarterm{template-name} +designates a type template template parameter \tcode{P}, +the type template template argument for \tcode{P} +shall be a deducible template. +Let \tcode{A} be an alias template +whose template parameter list is that of \tcode{P} and +whose \grammarterm{defining-type-id} is a \grammarterm{simple-template-id} +whose \grammarterm{template-name} designates the type template template argument and +whose \grammarterm{template-argument-list} is the template argument list of \tcode{P}. +\tcode{A} is then used instead of the original \grammarterm{template-name} +to resolve the placeholder. + \pnum When resolving a placeholder for a deduced class type\iref{dcl.type.simple} where @@ -1688,6 +1702,25 @@ \indextext{overloading!argument lists|)}% \indextext{overloading!candidate functions|)} +\pnum +\begin{example} +\begin{codeblock} +template +struct Y { + Y(); + Y(Ts ...); +}; +template class X> +void f() { + X x; // OK, deduces \tcode{Y} + X x0{}; // OK, deduces \tcode{Y} + X x1{1}; // OK, deduces \tcode{Y} + X x2{1, 2}; // error: cannot deduce \tcode{X} from \tcode{Y} +} +template void f(); +\end{codeblock} +\end{example} + \rSec2[over.match.viable]{Viable functions}% \indextext{overloading!resolution!viable functions|(} diff --git a/source/templates.tex b/source/templates.tex index d9f95f8ae0..8e154ebfd5 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -5660,7 +5660,9 @@ is dependent if \begin{itemize} \item -it has a dependent initializer, or +it has a dependent initializer, +\item +it refers to a type template template parameter, or \item it refers to an alias template that is a member of the current instantiation and