https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113052
Bug ID: 113052 Summary: Templated conversion operator of templated class is not considered in argument to equality operator Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ers.trion at gmail dot com Target Milestone: --- See https://godbolt.org/z/fWKfEj7zb . template <typename T> struct accessor { template <int = 0> operator T() const; }; void foo() { accessor<int> acc; (void) (acc == 10); } reports <source>: In function 'void foo()': <source>:9:21: error: no match for 'operator==' (operand types are 'accessor<int>' and 'int') 9 | (void) (acc == 10); | ~~~ ^~ ~~ | | | | | int | accessor<int> , but the code should be accepted (as Clang does). To trigger this bug it is necessary: - that the struct is templated - that the conversion operator return the template-argument type of the class - that the operator is templated as well (this was reduced from an enable_if) Possibly related: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89580 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85250