Skip to content
Merged
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
4 changes: 2 additions & 2 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
\indextext{region!declarative}%
\indextext{scope!potential}%
\defn{declarative region}, which is the largest part of the program
in which that name is \defn{valid}, that is, in which that name may
in which that name is valid, that is, in which that name may
be used as an unqualified name to refer to the same entity. In general,
each particular name is valid only within some possibly discontiguous
portion of program text called its \defn{scope}. To determine the
Expand Down Expand Up @@ -4156,7 +4156,7 @@
one is a standard-layout class object and
the other is the first non-static data member of that object, or,
if the object has no non-static data members,
the first base class subobject of that object\iref{class.mem}, or
any base class subobject of that object\iref{class.mem}, or
\item
there exists an object \placeholder{c} such that
\placeholder{a} and \placeholder{c} are pointer-interconvertible, and
Expand Down
8 changes: 5 additions & 3 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -801,10 +801,12 @@

\pnum
If a standard-layout class object has any non-static data members, its address
is the same as the address of its first non-static data member. Otherwise, its
address is the same as the address of its first base class subobject (if any).
is the same as the address of its first non-static data member
if that member is not a bit-field. Its
address is also the same as the address of each of its base class subobjects.
\begin{note}
There might therefore be unnamed padding within a standard-layout struct object, but
There might therefore be unnamed padding within a standard-layout struct object
inserted by an implementation, but
not at its beginning, as necessary to achieve appropriate alignment.
\end{note}
\begin{note}
Expand Down
5 changes: 4 additions & 1 deletion source/declarators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2315,7 +2315,10 @@
and
the number of elements in
the \grammarterm{identifier-list} shall be equal to the value of that
expression. The \grammarterm{unqualified-id} \tcode{get} is looked up
expression.
Let \tcode{i} be an index prvalue of type \tcode{std::size_t}
corresponding to $\tcode{v}_\tcode{i}$.
The \grammarterm{unqualified-id} \tcode{get} is looked up
in the scope of \tcode{E} by class member access lookup\iref{basic.lookup.classref},
and if that finds at least one declaration
that is a function template whose first template parameter
Expand Down
6 changes: 5 additions & 1 deletion source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5431,10 +5431,14 @@

\begin{itemize}
\item if \tcode{T1} and \tcode{T2} are the same class type
(ignoring cv-qualification), or one is a base class of the other, and
(ignoring cv-qualification) and
\tcode{T2} is at least as cv-qualified as \tcode{T1},
the target type is \tcode{T2},

\item otherwise, if \tcode{T2} is a base class of \tcode{T1},
the target type is \cvqual{cv1} \tcode{T2}, where \cvqual{cv1}
denotes the cv-qualifiers of \tcode{T1},

\item otherwise, the target type is the type that \tcode{E2} would have
after applying the
lvalue-to-rvalue\iref{conv.lval},
Expand Down
80 changes: 57 additions & 23 deletions source/templates.tex
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,45 @@
A \grammarterm{template-id} that names an alias template
specialization is a \grammarterm{type-name}.

\pnum
A \grammarterm{template-id} is \defnx{valid}{\idxgram{template-id}!valid} if
\begin{itemize}
\item
there are at most as many arguments as there are parameters
or a parameter is a template parameter pack\iref{temp.variadic},

\item
there is an argument for each non-deducible non-pack parameter
that does not have a default \grammarterm{template-argument},

\item
each \grammarterm{template-argument} matches the corresponding
\grammarterm{template-parameter}\iref{temp.arg},

\item
substitution of each template argument into the following
template parameters (if any) succeeds, and

\item
if the \grammarterm{template-id} is non-dependent,
the associated constraints are satisfied as specified in the next paragraph.
\end{itemize}
A \grammarterm{simple-template-id} shall be valid unless it names a
function template specialization\iref{temp.deduct}.
\begin{example}
\begin{codeblock}
template<class T, T::type n = 0> class X;
struct S {
using type = int;
};
using T1 = X<S, int, int>; // error: too many arguments
using T2 = X<>; // error: no default argument for first template parameter
using T3 = X<1>; // error: value \tcode{1} does not match type-parameter
using T4 = X<int>; // error: substitution failure for second template parameter
using T5 = X<S>; // OK
\end{codeblock}
\end{example}

\pnum
When the \grammarterm{template-name}
of a \grammarterm{simple-template-id}
Expand Down Expand Up @@ -5092,6 +5131,13 @@
declared with a type
that contains a placeholder type\iref{dcl.spec.auto},

\item
an
\grammarterm{identifier}
associated by name lookup with
a variable declared with a type that contains a placeholder type\iref{dcl.spec.auto}
where the initializer is type-dependent,

\item
an \grammarterm{identifier} associated by name lookup with one or more
declarations of member functions of the current instantiation declared
Expand Down Expand Up @@ -7026,30 +7072,11 @@
\end{example}

\pnum
When an explicit template argument list is specified, if the template
arguments are not compatible with the template parameter list or do
not result in a valid function type as described below, type
deduction fails. Specifically, the following steps are performed when
evaluating an explicitly specified template argument list with respect
to a given function template:
\begin{itemize}
\item If the specified template arguments do not match the template
parameters in
kind (i.e., type, non-type, template), or if there
are more arguments than there are parameters
and no parameter is a template parameter pack, or if there is not
an argument for each non-pack parameter,
type deduction fails.

\item If any non-type argument does not match the type of the
corresponding non-type
template parameter, and is not convertible to the type of the
corresponding non-type parameter as specified in~\ref{temp.arg.nontype},
When an explicit template argument list is specified, if the
given \grammarterm{template-id} is not valid\iref{temp.names},
type deduction fails.

\item The specified template argument values are substituted for the
Otherwise, the specified template argument values are substituted for the
corresponding template parameters as specified below.
\end{itemize}

\pnum
After this substitution is performed, the function parameter type
Expand Down Expand Up @@ -7146,6 +7173,9 @@
inside \tcode{sizeof}, \tcode{decltype}, and other contexts that allow non-constant
expressions. The substitution proceeds in lexical order and stops when
a condition that causes deduction to fail is encountered.
If substitution into different declarations of the same function template would
cause template instantiations to occur in a different order or not at all,
the program is ill-formed; no diagnostic required.
\begin{note}
The equivalent substitution in exception specifications is
done only when the \grammarterm{noexcept-specifier} is instantiated,
Expand All @@ -7159,10 +7189,14 @@
template <class T> void f(...) { }
template <class T> auto g(typename A<T>::X) -> typename T::X;
template <class T> void g(...) { }
template <class T> typename T::X h(typename A<T>::X);
template <class T> auto h(typename A<T>::X) -> typename T::X; // redeclaration
template <class T> void h(...) { }

void h() {
void x() {
f<int>(0); // OK, substituting return type causes deduction to fail
g<int>(0); // error, substituting parameter type instantiates \tcode{A<int>}
h<int>(0); // ill-formed, no diagnostic required
}
\end{codeblock}
\end{example}
Expand Down