Skip to content

Commit 75935f6

Browse files
committed
P3865R3
1 parent fda5e37 commit 75935f6

2 files changed

Lines changed: 46 additions & 3 deletions

File tree

source/declarations.tex

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,16 +1444,24 @@
14441444
if any, shall be non-dependent and
14451445
the \grammarterm{template-name} or \grammarterm{splice-specifier}
14461446
shall designate a deducible template.
1447-
A \defnadj{deducible}{template} is either a class template or
1448-
is an alias template whose \grammarterm{defining-type-id} is of the form
1447+
A \defnadj{deducible}{template} is
1448+
\begin{itemize}
1449+
\item
1450+
a class template,
1451+
\item
1452+
a type template template parameter, or
1453+
\item
1454+
an alias template \tcode{A} whose \grammarterm{defining-type-id} is of the form
14491455

14501456
\begin{ncsimplebnf}
14511457
\opt{\keyword{typename}} \opt{nested-name-specifier} \opt{\keyword{template}} simple-template-id
14521458
\end{ncsimplebnf}
14531459

14541460
where the \grammarterm{nested-name-specifier} (if any) is non-dependent and
14551461
the \grammarterm{template-name} of the \grammarterm{simple-template-id}
1456-
names a deducible template.
1462+
names a deducible template
1463+
other than a type template template parameter of \tcode{A}.
1464+
\end{itemize}
14571465
\begin{note}
14581466
An injected-class-name is never interpreted as a \grammarterm{template-name}
14591467
in contexts where class template argument deduction would be performed\iref{temp.local}.

source/overloading.tex

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,22 @@
14321432
\end{example}
14331433

14341434
\pnum
1435+
When resolving a placeholder for a deduced class type
1436+
where the \grammarterm{template-name} designates a type
1437+
template template parameter \tcode{P},
1438+
the type template template argument for \tcode{P}
1439+
shall be a deducible template.
1440+
Let \tcode{A} be an alias template
1441+
whose template parameter list is that of \tcode{P} and
1442+
whose \grammarterm{defining-type-id} is a \grammarterm{simple-template-id}
1443+
whose \grammarterm{template-name} designates the type template template argument and
1444+
whose \grammarterm{template-argument-list} is the template argument list of \tcode{P}.
1445+
\tcode{A} is then used instead of the original \grammarterm{template-name}
1446+
to resolve the placeholder.
1447+
1448+
\pnum
1449+
%FIXME: pull up this iref?
1450+
%dcl.type.simple is first attached to deduced class type above now
14351451
When resolving a placeholder for a deduced class type\iref{dcl.type.simple}
14361452
where
14371453
the \grammarterm{template-name} or \grammarterm{splice-type-specifier}
@@ -1688,6 +1704,25 @@
16881704
\indextext{overloading!argument lists|)}%
16891705
\indextext{overloading!candidate functions|)}
16901706

1707+
\pnum
1708+
\begin{example}
1709+
\begin{codeblock}
1710+
template<typename ... Ts>
1711+
struct Y {
1712+
Y();
1713+
Y(Ts ...);
1714+
};
1715+
template<template<typename T = char> class X>
1716+
void f() {
1717+
X x; // OK, deduces \tcode{Y<char>}
1718+
X x0{}; // OK, deduces \tcode{Y<char>}
1719+
X x1{1}; // OK, deduces \tcode{Y<int>}
1720+
X x2{1, 2}; // error: cannot deduce \tcode{X<T>} from \tcode{Y<int, int>}
1721+
}
1722+
template void f<Y>();
1723+
\end{codeblock}
1724+
\end{example}
1725+
16911726
\rSec2[over.match.viable]{Viable functions}%
16921727
\indextext{overloading!resolution!viable functions|(}
16931728

0 commit comments

Comments
 (0)