|
1274 | 1274 | the trailing sequence of parameters corresponding
|
1275 | 1275 | to a trailing aggregate element that is a pack expansion (if any)
|
1276 | 1276 | is replaced by a single parameter of the form $\tcode{T}_n \tcode{...}$.
|
| 1277 | +In addition, |
| 1278 | +if \tcode{C} is defined and |
| 1279 | +inherits constructors\iref{namespace.udecl} |
| 1280 | +from a direct base class denoted in the \grammarterm{base-specifier-list} |
| 1281 | +by a \grammarterm{class-or-decltype} \tcode{B}, |
| 1282 | +let \tcode{A} be an alias template |
| 1283 | +whose template parameter list is that of \tcode{C} and |
| 1284 | +whose \grammarterm{defining-type-id} is \tcode{B}. |
| 1285 | +%% FIXME: the following sentence is very hard to follow; rewrite! |
| 1286 | +If \tcode{A} is a deducible template\iref{dcl.type.simple}, |
| 1287 | +the set contains the guides of \tcode{A} |
| 1288 | +with the return type \tcode{R} of each guide |
| 1289 | +replaced with \tcode{typename CC<R>::type} given a class template |
| 1290 | +\begin{codeblock} |
| 1291 | +template <typename> class CC; |
| 1292 | +\end{codeblock} |
| 1293 | +whose primary template is not defined and |
| 1294 | +with a single partial specialization |
| 1295 | +whose template parameter list is that of \tcode{A} and |
| 1296 | +whose template argument list is a specialization of \tcode{A} with |
| 1297 | +the template argument list of \tcode{A}\iref{temp.dep.type} |
| 1298 | +having a member typedef \tcode{type} designating a template specialization with |
| 1299 | +the template argument list of \tcode{A} but |
| 1300 | +with \tcode{C} as the template. |
| 1301 | +\begin{note} |
| 1302 | +Equivalently, |
| 1303 | +the template parameter list of the specialization is that of \tcode{C}, |
| 1304 | +the template argument list of the specialization is \tcode{B}, and |
| 1305 | +the member typedef names \tcode{C} with the template argument list of \tcode{C}. |
| 1306 | +\end{note} |
| 1307 | + |
| 1308 | +\pnum |
| 1309 | +\begin{example} |
| 1310 | +\begin{codeblock} |
| 1311 | +template <typename T> struct B { |
| 1312 | + B(T); |
| 1313 | +}; |
| 1314 | +template <typename T> struct C : public B<T> { |
| 1315 | + using B<T>::B; |
| 1316 | +}; |
| 1317 | +template <typename T> struct D : public B<T> {}; |
| 1318 | + |
| 1319 | +C c(42); // OK, deduces \tcode{C<int>} |
| 1320 | +D d(42); // error: deduction failed, no inherited deduction guides |
| 1321 | +B(int) -> B<char>; |
| 1322 | +C c2(42); // OK, deduces \tcode{C<char>} |
| 1323 | + |
| 1324 | +template <typename T> struct E : public B<int> { |
| 1325 | + using B<int>::B; |
| 1326 | +}; |
| 1327 | + |
| 1328 | +E e(42); // error: deduction failed, arguments of \tcode{E} cannot be deduced from introduced guides |
| 1329 | + |
| 1330 | +template <typename T, typename U, typename V> struct F { |
| 1331 | + F(T, U, V); |
| 1332 | +}; |
| 1333 | +template <typename T, typename U> struct G : F<U, T, int> { |
| 1334 | + using G::F::F; |
| 1335 | +} |
| 1336 | + |
| 1337 | +G g(true, 'a', 1); // OK, deduces \tcode{G<char, bool>} |
| 1338 | +\end{codeblock} |
| 1339 | +\end{example} |
1277 | 1340 |
|
1278 | 1341 | \pnum
|
1279 | 1342 | When resolving a placeholder for a deduced class type\iref{dcl.type.simple}
|
|
1741 | 1804 | \end{example}
|
1742 | 1805 | or, if not that
|
1743 | 1806 |
|
| 1807 | +\item |
| 1808 | +\tcode{F1} and \tcode{F2} are generated |
| 1809 | +from class template argument deduction\iref{over.match.class.deduct} |
| 1810 | +for a class \tcode{D}, and |
| 1811 | +\tcode{F2} is generated |
| 1812 | +from inheriting constructors from a base class of \tcode{D} |
| 1813 | +while \tcode{F1} is not, and |
| 1814 | +for each explicit function argument, |
| 1815 | +the corresponding parameters of \tcode{F1} and \tcode{F2} |
| 1816 | +are either both ellipses or have the same type, |
| 1817 | +or, if not that, |
| 1818 | + |
1744 | 1819 | \item
|
1745 | 1820 | \tcode{F1} is generated from a
|
1746 | 1821 | \grammarterm{deduction-guide}\iref{over.match.class.deduct}
|
|
0 commit comments