Created on 2023-01-09.00:00:00 last changed 22 months ago
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.
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-01-14 21:59:47 | admin | set | messages: + msg7130 |
2023-01-09 00:00:00 | admin | create |