Created on 2016-07-05.00:00:00 last changed 81 months ago
Rationale (July, 2017):
CWG determined that no change was needed.
It is not clear whether the current treatment of an example like the following is what we want:
template<typename T> void foo(T, int); template<typename T> void foo(T&, ...); struct Q; void fn1(Q &data_vectors) { foo(data_vectors, 0); }
According to 12.2.4.2 [over.best.ics] paragraph 8,
If no conversions are required to match an argument to a parameter type, the implicit conversion sequence is the standard conversion sequence consisting of the identity conversion (12.2.4.2.2 [over.ics.scs]).
This would select the first overload and then fail in attempting to call it because of the incomplete type. On the other hand, it is ill-formed to define or call a function with an incomplete parameter type, although it can be declared, so it might be reasonable to take completeness of the parameter type into consideration for SFINAE purposes. 13.10.3 [temp.deduct] bullet 8.11 says,
[Note: Type deduction may fail for the following reasons:
...
Attempting to create a function type in which a parameter type or the return type is an abstract class type (11.7.4 [class.abstract]).
If a definition of Q were available, we would need to instantiate it to see if it is abstract.
It would seem reasonable for an incomplete type to be invalid as well. That would be consistent with the other rules and general desire not to select functions you can't call based on the template argument types.
History | |||
---|---|---|---|
Date | User | Action | Args |
2018-02-27 00:00:00 | admin | set | messages: + msg6019 |
2016-07-05 00:00:00 | admin | create |