Created on 2015-02-26.00:00:00 last changed 119 months ago
The candidates selected by 12.2.2.3 [over.match.oper] include built-in candidates that will result in an error if chosen; this was affirmed by issue 1687. As a result, t+u is ill-formed because it is resolved to the built-in operator+(int*,std::ptrdiff_t), although most implementations do not (yet) agree:
struct Adaptor { Adaptor(int); }; struct List { }; void operator +(List &, Adaptor); struct DataType { operator int *() const = delete; operator List &() const; }; struct Yea; struct Nay { int theNaysHaveIt; }; template <typename T, typename U> Yea addCheck(int, T &&t, U &&u, char (*)[sizeof(t + u, 0)] = 0); template <typename T, typename U> Nay addCheck(void *, T &&t, U &&u); void test(DataType &data) { (void)sizeof(addCheck(0, data, 0.).theNaysHaveIt); }
It might be better to adjust the candidate list in 12.2.2.4 [over.match.ctor] bullet 3.3.3 to allow conversion only on class types and exclude the second standard conversion sequence.
History | |||
---|---|---|---|
Date | User | Action | Args |
2015-02-26 00:00:00 | admin | create |