public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96004] New: Copy elision with conditional
@ 2020-06-30 14:24 antoshkka at gmail dot com
  2021-11-19 20:42 ` [Bug c++/96004] " gcc_bugzilla at axeitado dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: antoshkka at gmail dot com @ 2020-06-30 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96004
           Summary: Copy elision with conditional
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Consider the example:


struct Struct {
    Struct() = default;
    Struct(Struct&&);
};

Struct question10(bool b) {
    if (b) {
        Struct s{};
        return s;
    } else {
        return {};
    }
}


It is possible to elide move constructor call as the lifetimes of object `s`
and `return {}` do not intersect.

(some other compilers already do copy elision in that place
https://godbolt.org/z/wdpLkT )

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

* [Bug c++/96004] Copy elision with conditional
  2020-06-30 14:24 [Bug c++/96004] New: Copy elision with conditional antoshkka at gmail dot com
@ 2021-11-19 20:42 ` gcc_bugzilla at axeitado dot com
  2022-10-31 18:09 ` pinskia at gcc dot gnu.org
  2023-06-06 16:11 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gcc_bugzilla at axeitado dot com @ 2021-11-19 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Óscar Fuentes <gcc_bugzilla at axeitado dot com> ---
This looks like a duplicate of PR53637 / PR53637.

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

* [Bug c++/96004] Copy elision with conditional
  2020-06-30 14:24 [Bug c++/96004] New: Copy elision with conditional antoshkka at gmail dot com
  2021-11-19 20:42 ` [Bug c++/96004] " gcc_bugzilla at axeitado dot com
@ 2022-10-31 18:09 ` pinskia at gcc dot gnu.org
  2023-06-06 16:11 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-31 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-10-31
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/96004] Copy elision with conditional
  2020-06-30 14:24 [Bug c++/96004] New: Copy elision with conditional antoshkka at gmail dot com
  2021-11-19 20:42 ` [Bug c++/96004] " gcc_bugzilla at axeitado dot com
  2022-10-31 18:09 ` pinskia at gcc dot gnu.org
@ 2023-06-06 16:11 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2023-06-06 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Óscar Fuentes from comment #1)
> This looks like a duplicate of PR53637 / PR53637.

More 58487.

*** This bug has been marked as a duplicate of bug 58487 ***

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

end of thread, other threads:[~2023-06-06 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 14:24 [Bug c++/96004] New: Copy elision with conditional antoshkka at gmail dot com
2021-11-19 20:42 ` [Bug c++/96004] " gcc_bugzilla at axeitado dot com
2022-10-31 18:09 ` pinskia at gcc dot gnu.org
2023-06-06 16:11 ` jason 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).