public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "flast at flast dot jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63437] [4.9/5 regression][C++14] Parenthesized "movable but not copyable" object doesn't compile in return statement
Date: Thu, 02 Oct 2014 07:40:00 -0000	[thread overview]
Message-ID: <bug-63437-4-RRSDgNexPE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63437-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Kohei Takahashi <flast at flast dot jp> ---
(In reply to Andrew Pinski from comment #1)
> in C++14 (a) means the same as static_cast<typeof(a) &>(a).
> 
> So it is a reference at this point which means const & is better than &&.
> 
> Or at least that is how I understand this.  Does clang implement the C++11
> () rule correctly?

n3376 12.8 [class.copy] paragraph 32 says:

    When the criteria for elision of a copy operation are met or would be met
save for the fact that the source
    object is a function parameter, and the object to be copied is designated
by an lvalue, overload resolution to
    select the constructor for the copy is first performed as if the object
were designated by an rvalue.

And latest draft says more clearly.
https://github.com/cplusplus/draft/blob/master/source/special.tex#L3021-L3062

Therefore, I think move should be performed even if parenthesized.


  parent reply	other threads:[~2014-10-02  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02  2:26 [Bug c++/63437] New: " flast at flast dot jp
2014-10-02  3:03 ` [Bug c++/63437] " pinskia at gcc dot gnu.org
2014-10-02  7:40 ` flast at flast dot jp [this message]
2014-10-02  9:08 ` redi at gcc dot gnu.org
2014-10-09 18:05 ` jason at gcc dot gnu.org
2014-10-10 20:35 ` jason at gcc dot gnu.org
2014-10-10 20:38 ` jason at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-63437-4-RRSDgNexPE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).