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

            Bug ID: 87109
           Summary: Wrong overload picked with ref-qualifiers
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

As discussed in <https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01607.html>, g++
chooses the wrong overload for f1:

#include <utility>

struct C { };
struct A {
  operator C() &;
  operator C() &&;
};

C f1(A a)
{
   return a; // should call operator C()&, but calls operator C()&&
}

C f2(A a)
{
   return std::move(a); // calls operator C()&&
}

Reply via email to