[Bug libstdc++/60966] std::call_once sometime hangs
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 25 18:36:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60966
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> > N.B. the std::move in Manager::cancelConnection is redundant, the return
> > value from cancel_connection is already an rvalue.
>
> Yes, I know, the problem is I have some hard time to avoid doing this as it
> is more for me and what I expect the compiler to do or the semantics I want
> the code to have :)
OK, but it makes the code worse. Here the compiler will elide the move
constructor (aka return value optimisation):
auto future = cancel_connection(c);
Whereas here the compiler cannot do that and must call a move constructor:
auto future = std::move(cancel_connection(c));
More information about the Gcc-bugs
mailing list