https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87989

            Bug ID: 87989
           Summary: Calling operator T() invokes wrong conversion operator
                    overload
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kretz at kde dot org
  Target Milestone: ---

Testcase (https://godbolt.org/z/sStNGV):

struct X {
    template <class T> operator T() const;
    operator float() const;
};

template <class T>
T f(const X &x) { return x.operator T(); }

template float f<float>(const X &);

Starting with GCC8, this calls `X::operator float<float>() const` instead of
`X::operator float() const`. The behavior is correct if function f is changed
to `{ return x; }`; i.e. implicit call of the conversion operator.

I have not double-checked the standard, but clang, EDG, MSVC and GCC <= 7 do
not show this behavior.

Reply via email to