https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107771
Bug ID: 107771 Summary: Cannot resolve templated conversion operator in templated struct Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: alvinhochun at gmail dot com Target Milestone: --- With this code: === template <typename T> struct bind_in { bind_in(T const& object) noexcept : object(object) {} T const& object; template <typename R> operator R const& () const noexcept { return reinterpret_cast<R const&>(object); } }; struct SomeType { int v; }; void func(SomeType in); void x(const SomeType& v) { func(bind_in(v)); } === GCC produces an error: error: could not convert 'bind_in<SomeType>((* & v))' from 'bind_in<SomeType>' to 'SomeType' Compiler Explorer: https://godbolt.org/z/rrhY7rr3b