Created on 2014-12-03.00:00:00 last changed 95 months ago
[Moved to DR at the October, 2015 meeting.]
Proposed resolution (May, 2015):
Change 13.10.4 [temp.over] paragraph 1 as follows,
...If, for a given function template, argument deduction fails or the synthesized function template specialization would be ill-formed, no such function is added to the set of candidate functions for that template.
In an example like
struct A { operator int(); }; template<typename T> T operator<<(T, int); void f(A a) { 1 << a; }
Template argument deduction succeeds for the operator template, producing the signature operator<<(int,int). The resulting declaration is synthesized and added to the overload set, per 13.10.4 [temp.over] paragraph 1. However, this violates the requirement of 12.4 [over.oper] paragraph 6,
An operator function shall either be a non-static member function or be a non-member function that has at least one parameter whose type is a class, a reference to a class, an enumeration, or a reference to an enumeration.
This is not a SFINAE context, so the program is ill-formed, rather than selecting the built-in operator.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: dr -> cd4 |
2015-11-10 00:00:00 | admin | set | messages: + msg6077 |
2015-11-10 00:00:00 | admin | set | status: ready -> dr |
2015-05-25 00:00:00 | admin | set | messages: + msg5462 |
2014-12-03 00:00:00 | admin | create |