This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
Consider:
template<typename T>
struct X
{
int i{};
T t;
};
X x{ .t = X<int>{ 1, 2 } }; // should deduce X<X<int>> (not X<int>)
and
template<typename T>
struct Y
{
int i;
T t;
int j;
};
template<typename T>
Y(int, T) -> Y<T>;
Y y{ .t = 'c', .j = 2 }; // should be ill-formed
Class template argument deduction does not limit deduction to the aggregate deduction candidate when a designated initializer list is used.
Suggested resolution:
Change in 12.2.2.9 [over.match.class.deduct] paragraph 1 as follows:
... If the initializer has a designated-initializer-list, any guide that is not an aggregate deduction candidate is not viable; for an aggregate deduction candidate, the designated-initializer-list is replaced by an initializer-list with the same elements. In addition, if C is defined and inherits constructors (9.9 [namespace.udecl]) from a direct base class ...
Change in 12.2.2.9 [over.match.class.deduct] bullet 3.5 as follows:
- ...
- If f was generated from a deduction-guide (13.7.2.3 [temp.deduct.guide]), then f' is considered to be so as well.
- If f was generated from an aggregate deduction guide, then f' is considered to be so as well.