https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89580
Bug ID: 89580
Summary: overload resolution for pointers fails to consider
conversion operator
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eric at efcs dot ca
Target Milestone: ---
I believe the following code is valid and should be accepted.
// g++ -std=c++11
struct Foo {
template <class T> operator T() const;
};
// error: no match for 'operator==' (operand types are 'Foo' and 'void*')
bool R = (Foo{} == static_cast<void*>(nullptr));
Note that when Foo's conversion operator is declared as `operator T*()`, the
code is accepted.
See https://godbolt.org/z/nc43wx