public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67200] New: Copy elision and implicit move in return performed in cases not allowed by standard
@ 2015-08-13  5:25 rs2740 at gmail dot com
  2015-08-13  7:59 ` [Bug c++/67200] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: rs2740 at gmail dot com @ 2015-08-13  5:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67200
           Summary: Copy elision and implicit move in return performed in
                    cases not allowed by standard
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Consider:

struct A {
    A() = default;
    A(const A&) = delete;
    A(A&&) = default;
};

A f() {
    A a;
    return true ? a : a;
}

This code is ill-formed; `true ? a : a` is an lvalue of type `A`; it neither
qualifies for copy elision under [class.copy]/p31 (it is not "the name of a
nonvolatile
automatic object") nor for implicit moving under [class.copy]/p32 (it's not an
id-expression, either). Therefore, overload resolution should select the copy
constructor, which in the above example is deleted.

GCC compiles this code and in fact elides a move.


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

* [Bug c++/67200] Copy elision and implicit move in return performed in cases not allowed by standard
  2015-08-13  5:25 [Bug c++/67200] New: Copy elision and implicit move in return performed in cases not allowed by standard rs2740 at gmail dot com
@ 2015-08-13  7:59 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2015-08-13  7:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-13
     Ever confirmed|0                           |1


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

end of thread, other threads:[~2015-08-13  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-13  5:25 [Bug c++/67200] New: Copy elision and implicit move in return performed in cases not allowed by standard rs2740 at gmail dot com
2015-08-13  7:59 ` [Bug c++/67200] " redi 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).