http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57064



             Bug #: 57064

           Summary: [clarification requested] Which overload with

                    ref-qualifier should be called?

    Classification: Unclassified

           Product: gcc

           Version: 4.8.1

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: thi...@kde.org





I'm not sure this is a bug. I am requesting clarification on the behaviour.



>From the C++11 standard (13.3.3.2 [over.ics.rank] p 3):



struct A {

    void p() &;

    void p() &&;

};



void f()

{

    A a;

    a.p();

    A().p();

}



GCC 4.8.1 correctly calls the lvalue-ref overload first, then the rvalue

overload second.



Now suppose the following function:



void g(A &&a)

{

    a.p();

}



Which overload should GCC call? This is my request for clarification. I

couldn't find anything specific in the standard that would help explain one way

or the other.



Intuitively, it would be the rvalue overload, but gcc calls the lvalue overload

instead. Making it:



    std::move(a).p();



Does not help.

Reply via email to