[PATCH] New warning -Wpessimizing-move to catch when removing calls to std::move in return statements will result in NRVO

Richard Smith richard at metafoo.co.uk
Wed Feb 18 17:29:46 PST 2015

I don't think it's appropriate for this warning to look at whether we would have actually performed NRVO. Instead, I would suggest modeling this as follows: when we perform initialization, and the source expression is std::move(x), and x is of class type, and either x is a prvalue or {we're initializing a return object and x is the name of a local variable or parameter of the returned type ignoring cv-qualification}, emit a warning.



More information about the cfe-commits mailing list