[Bug c++/72580] Cannot throw non movable object
gleb at scylladb dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 26 11:56:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72580
Gleb Natapov <gleb at scylladb dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |FIXED
--- Comment #4 from Gleb Natapov <gleb at scylladb dot com> ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to Gleb Natapov from comment #2)
> > As far as I see it talks about copy constructor not move constructor.
>
> No, it says "the constructor" not "the copy constructor".
>
> Copy initialization refers to the syntactic form of initialization, not
> whether it uses a copy constructor or a move constructor.
>
> It also specifically talks about "the copy/move operation".
Spec talks about "the constructor selected for the copy-initialization". In my
example throw gets lvalue object, so the object should be copied but the copy
is elided. If I made object const the code compiles since copy cannot be
elided. If I would throw E(1) then it would elide move indeed.
Not that I doubt your reading of the spec, you are obviously more experienced
in this (and Intel agrees with you), but I would like to understand it better.
More information about the Gcc-bugs
mailing list