Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1444,16 +1444,24 @@
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
\end{ncsimplebnf}

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}.
Expand Down
33 changes: 33 additions & 0 deletions source/overloading.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1688,6 +1702,25 @@
\indextext{overloading!argument lists|)}%
\indextext{overloading!candidate functions|)}

\pnum
\begin{example}
\begin{codeblock}
template<typename ... Ts>
struct Y {
Y();
Y(Ts ...);
};
template<template<typename T = char> class X>
void f() {
X x; // OK, deduces \tcode{Y<char>}
X x0{}; // OK, deduces \tcode{Y<char>}
X x1{1}; // OK, deduces \tcode{Y<int>}
X x2{1, 2}; // error: cannot deduce \tcode{X<T>} from \tcode{Y<int, int>}
}
template void f<Y>();
\end{codeblock}
\end{example}

\rSec2[over.match.viable]{Viable functions}%
\indextext{overloading!resolution!viable functions|(}

Expand Down
4 changes: 3 additions & 1 deletion source/templates.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading