Skip to content
Merged
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
75 changes: 75 additions & 0 deletions source/overloading.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,69 @@
the trailing sequence of parameters corresponding
to a trailing aggregate element that is a pack expansion (if any)
is replaced by a single parameter of the form $\tcode{T}_n \tcode{...}$.
In addition,
if \tcode{C} is defined and
inherits constructors\iref{namespace.udecl}
from a direct base class denoted in the \grammarterm{base-specifier-list}
by a \grammarterm{class-or-decltype} \tcode{B},
let \tcode{A} be an alias template
whose template parameter list is that of \tcode{C} and
whose \grammarterm{defining-type-id} is \tcode{B}.
%% FIXME: the following sentence is very hard to follow; rewrite!
If \tcode{A} is a deducible template\iref{dcl.type.simple},
the set contains the guides of \tcode{A}
with the return type \tcode{R} of each guide
replaced with \tcode{typename CC<R>::type} given a class template
\begin{codeblock}
template <typename> class CC;
\end{codeblock}
whose primary template is not defined and
with a single partial specialization
whose template parameter list is that of \tcode{A} and
whose template argument list is a specialization of \tcode{A} with
the template argument list of \tcode{A}\iref{temp.dep.type}
having a member typedef \tcode{type} designating a template specialization with
the template argument list of \tcode{A} but
with \tcode{C} as the template.
\begin{note}
Equivalently,
the template parameter list of the specialization is that of \tcode{C},
the template argument list of the specialization is \tcode{B}, and
the member typedef names \tcode{C} with the template argument list of \tcode{C}.
\end{note}

\pnum
\begin{example}
\begin{codeblock}
template <typename T> struct B {
B(T);
};
template <typename T> struct C : public B<T> {
using B<T>::B;
};
template <typename T> struct D : public B<T> {};

C c(42); // OK, deduces \tcode{C<int>}
D d(42); // error: deduction failed, no inherited deduction guides
B(int) -> B<char>;
C c2(42); // OK, deduces \tcode{C<char>}

template <typename T> struct E : public B<int> {
using B<int>::B;
};

E e(42); // error: deduction failed, arguments of \tcode{E} cannot be deduced from introduced guides

template <typename T, typename U, typename V> struct F {
F(T, U, V);
};
template <typename T, typename U> struct G : F<U, T, int> {
using G::F::F;
}

G g(true, 'a', 1); // OK, deduces \tcode{G<char, bool>}
\end{codeblock}
\end{example}

\pnum
When resolving a placeholder for a deduced class type\iref{dcl.type.simple}
Expand Down Expand Up @@ -1741,6 +1804,18 @@
\end{example}
or, if not that

\item
\tcode{F1} and \tcode{F2} are generated
from class template argument deduction\iref{over.match.class.deduct}
for a class \tcode{D}, and
\tcode{F2} is generated
from inheriting constructors from a base class of \tcode{D}
while \tcode{F1} is not, and
for each explicit function argument,
the corresponding parameters of \tcode{F1} and \tcode{F2}
are either both ellipses or have the same type,
or, if not that,

\item
\tcode{F1} is generated from a
\grammarterm{deduction-guide}\iref{over.match.class.deduct}
Expand Down