public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57064] New: [clarification requested] Which overload with ref-qualifier should be called?
@ 2013-04-25  0:29 thiago at kde dot org
  2013-04-25  0:45 ` [Bug c++/57064] " thiago at kde dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: thiago at kde dot org @ 2013-04-25  0:29 UTC (permalink / raw)
  To: gcc-bugs


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: unassigned@gcc.gnu.org
        ReportedBy: thiago@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.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-04-26 13:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-25  0:29 [Bug c++/57064] New: [clarification requested] Which overload with ref-qualifier should be called? thiago at kde dot org
2013-04-25  0:45 ` [Bug c++/57064] " thiago at kde dot org
2013-04-25  0:45 ` thiago at kde dot org
2013-04-25  0:53 ` thiago at kde dot org
2013-04-25  6:19 ` glisse at gcc dot gnu.org
2013-04-25  6:34 ` glisse at gcc dot gnu.org
2013-04-25  6:51 ` thiago at kde dot org
2013-04-25  7:13 ` thiago at kde dot org
2013-04-25  7:28 ` glisse at gcc dot gnu.org
2013-04-25  7:34 ` thiago at kde dot org
2013-04-25 14:42 ` jason at gcc dot gnu.org
2013-04-25 17:50 ` jason at gcc dot gnu.org
2013-04-26  5:05 ` glisse at gcc dot gnu.org
2013-04-26  6:16 ` thiago at kde dot org
2013-04-26  8:12 ` redi at gcc dot gnu.org
2013-04-26 13:45 ` thiago at kde dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).