Skip to content

Commit c57ffb9

Browse files
committed
[temp.deduct] Split long paragraph 8
1 parent bbd5de2 commit c57ffb9

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

source/templates.tex

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6853,16 +6853,13 @@
68536853
or obtained from default
68546854
\grammarterm{template-argument}{s}.
68556855
\begin{example}
6856-
68576856
\begin{codeblock}
68586857
void f(Array<dcomplex>& cv, Array<int>& ci) {
68596858
sort(cv); // calls \tcode{sort(Array<dcomplex>\&)}
68606859
sort(ci); // calls \tcode{sort(Array<int>\&)}
68616860
}
68626861
\end{codeblock}
6863-
68646862
and
6865-
68666863
\begin{codeblock}
68676864
void g(double d) {
68686865
int i = convert<int>(d); // calls \tcode{convert<int,double>(double)}
@@ -6878,7 +6875,6 @@
68786875
deduction fails. Specifically, the following steps are performed when
68796876
evaluating an explicitly specified template argument list with respect
68806877
to a given function template:
6881-
68826878
\begin{itemize}
68836879
\item The specified template arguments must match the template parameters in
68846880
kind (i.e., type, non-type, template). There
@@ -6908,7 +6904,6 @@
69086904
variable within the function.
69096905
\end{note}
69106906
\begin{example}
6911-
69126907
\begin{codeblock}
69136908
template <class T> void f(T t);
69146909
template <class X> void g(const X x);
@@ -6962,7 +6957,6 @@
69626957
}
69636958
\end{codeblock}
69646959
\end{example}
6965-
69666960
When all template arguments have been deduced or obtained from
69676961
default template arguments, all uses of template parameters in
69686962
the template parameter list of the template and the function type
@@ -6989,10 +6983,13 @@
69896983
template arguments but also general expressions (i.e., non-constant expressions)
69906984
inside \tcode{sizeof}, \tcode{decltype}, and other contexts that allow non-constant
69916985
expressions. The substitution proceeds in lexical order and stops when
6992-
a condition that causes deduction to fail is encountered. \begin{note} The equivalent substitution in exception specifications is
6993-
done only when the \grammarterm{noexcept-specifier} is instantiated, at which point a program is ill-formed
6994-
if the substitution results in an invalid type or
6995-
expression. \end{note}
6986+
a condition that causes deduction to fail is encountered.
6987+
\begin{note}
6988+
The equivalent substitution in exception specifications is
6989+
done only when the \grammarterm{noexcept-specifier} is instantiated,
6990+
at which point a program is ill-formed
6991+
if the substitution results in an invalid type or expression.
6992+
\end{note}
69966993
\begin{example}
69976994
\begin{codeblock}
69986995
template <class T> struct A { using X = typename T::X; };
@@ -7011,17 +7008,25 @@
70117008
\pnum
70127009
If a substitution results in an invalid type or expression, type deduction fails. An
70137010
invalid type or expression is one that would be ill-formed, with a diagnostic
7014-
required, if written using the substituted arguments. \begin{note} If no
7011+
required, if written using the substituted arguments.
7012+
\begin{note}
7013+
If no
70157014
diagnostic is required, the program is still ill-formed. Access checking is done
70167015
as part of the substitution
7017-
process. \end{note} Only invalid types and expressions in the immediate
7016+
process.
7017+
\end{note}
7018+
Only invalid types and expressions in the immediate
70187019
context of the function type and its template parameter types can result in a deduction
7019-
failure. \begin{note} The substitution into types and expressions can result
7020+
failure.
7021+
\begin{note}
7022+
The substitution into types and expressions can result
70207023
in effects such as the instantiation of class template specializations and/or
70217024
function template specializations, the generation of implicitly-defined functions,
70227025
etc. Such effects are not in the ``immediate context'' and can result in the
7023-
program being ill-formed.\end{note}
7026+
program being ill-formed.
7027+
\end{note}
70247028

7029+
\pnum
70257030
\begin{example}
70267031
\begin{codeblock}
70277032
struct X { };
@@ -7036,17 +7041,16 @@
70367041
X x3 = f(x1, x2); // deduction fails on \#1 (cannot add \tcode{X+X}), calls \#2\end{codeblock}
70377042
\end{example}
70387043

7039-
\begin{note} Type deduction may fail for
7040-
the following reasons:
7041-
7044+
\pnum
7045+
\begin{note}
7046+
Type deduction may fail for the following reasons:
70427047
\begin{itemize}
70437048
\item Attempting to instantiate a pack expansion containing multiple parameter packs of differing lengths.
70447049
\item
70457050
Attempting to create an array with an element type that is \tcode{void}, a
70467051
function type, a reference type, or an abstract class type, or attempting
70477052
to create an array with a size that is zero or negative.
70487053
\begin{example}
7049-
70507054
\begin{codeblock}
70517055
template <class T> int f(T[5]);
70527056
int I = f<int>(0);
@@ -7056,7 +7060,6 @@
70567060
\item
70577061
Attempting to use a type that is not a class or enumeration type in a qualified name.
70587062
\begin{example}
7059-
70607063
\begin{codeblock}
70617064
template <class T> int f(typename T::B*);
70627065
int i = f<int>(0);
@@ -7075,7 +7078,6 @@
70757078
the specified member is not a non-type where a non-type is required.
70767079
\end{itemize}
70777080
\begin{example}
7078-
70797081
\begin{codeblock}
70807082
template <int I> struct X { };
70817083
template <template <class T> class> struct Z { };
@@ -7108,7 +7110,6 @@
71087110
Attempting to create ``pointer to member of \tcode{T}'' when \tcode{T} is not a
71097111
class type.
71107112
\begin{example}
7111-
71127113
\begin{codeblock}
71137114
template <class T> int f(int T::*);
71147115
int i = f<int>(0);

0 commit comments

Comments
 (0)