public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61504] New: Move elision after cast to rvalue reference
@ 2014-06-13 17:55 dyp-cpp at gmx dot net
  2021-08-04 19:36 ` [Bug c++/61504] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dyp-cpp at gmx dot net @ 2014-06-13 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61504
           Summary: Move elision after cast to rvalue reference
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dyp-cpp at gmx dot net

Created attachment 32935
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32935&action=edit
Test case as in description.

Move elision is applied even though the object has been bound to a reference
(see [class.copy]/31). Test case:

---------------

#include <iostream>

struct loud
{
    loud()        { std::cout << "default\n"; }
    loud(loud &&) { std::cout << "move\n"; }
    ~loud()       { std::cout << "dtor\n"; }
};

int main()
{
    loud l1{ static_cast<loud&&>(loud{}) };
}

------------------

Expected output (also, recent clang++):

default
move
dtor
dtor

Output produced by g++ -std=c++11 -Wall -Wextra -pedantic 4.10.0 20140611:

default
dtor

Possibly related:
http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1376


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

* [Bug c++/61504] Move elision after cast to rvalue reference
  2014-06-13 17:55 [Bug c++/61504] New: Move elision after cast to rvalue reference dyp-cpp at gmx dot net
@ 2021-08-04 19:36 ` pinskia at gcc dot gnu.org
  2021-08-05 10:58 ` redi at gcc dot gnu.org
  2021-08-13 22:58 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |6.4.0
           Keywords|                            |wrong-code
         Resolution|---                         |FIXED
      Known to work|                            |7.1.0
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 7+.

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

* [Bug c++/61504] Move elision after cast to rvalue reference
  2014-06-13 17:55 [Bug c++/61504] New: Move elision after cast to rvalue reference dyp-cpp at gmx dot net
  2021-08-04 19:36 ` [Bug c++/61504] " pinskia at gcc dot gnu.org
@ 2021-08-05 10:58 ` redi at gcc dot gnu.org
  2021-08-13 22:58 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-05 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed by r245538:

    PR c++/79533 - C++17 ICE with temporary cast to reference

            * call.c (build_over_call): Conversion to a reference prevents copy
            elision.

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

* [Bug c++/61504] Move elision after cast to rvalue reference
  2014-06-13 17:55 [Bug c++/61504] New: Move elision after cast to rvalue reference dyp-cpp at gmx dot net
  2021-08-04 19:36 ` [Bug c++/61504] " pinskia at gcc dot gnu.org
  2021-08-05 10:58 ` redi at gcc dot gnu.org
@ 2021-08-13 22:58 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-13 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |7.0

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

end of thread, other threads:[~2021-08-13 22:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 17:55 [Bug c++/61504] New: Move elision after cast to rvalue reference dyp-cpp at gmx dot net
2021-08-04 19:36 ` [Bug c++/61504] " pinskia at gcc dot gnu.org
2021-08-05 10:58 ` redi at gcc dot gnu.org
2021-08-13 22:58 ` pinskia at gcc dot gnu.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).