[cfe-dev] [llvm-dev] New warnings when building trunk with GCC 9

Stephan Bergmann via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 26 08:08:34 PDT 2018


On 25/09/2018 05:40, Richard Trieu via cfe-dev wrote:
> It looks like what's happening is that Clang and GCC handles the return 
> differently.  Clang needs the std::move call to use the move constructor 
> while GCC will use the move constructor with or without the std::move 
> call.  This means that the warning is currently correct when running on 
> either compiler.
> 
> This is a reduced example.  Compiled with Clang, it will print "move 
> constructor" then "copy constructor".  GCC will print "move constructor" 
> twice.

For the erroneous GCC behavior, see 
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87150> "move ctor wrongly 
chosen in return stmt (derived vs. base)".



More information about the cfe-dev mailing list