Fix -Wredundant-move warnings, 2nd try

std::move is redundant when it is used to return a local object from a function (eg return std::move(local)): indeed, returning a local object from a function implicitly moves it. Moreover using std::move this way
See https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rf-return-move-local
However, in order to avoid -Wreturn-std-move as well, a Base object is move-constructed
from Derived when required.
This commit is contained in:
howetuft
2019-11-16 10:41:05 +01:00
committed by wmayer
parent 4b5ca31149
commit fb64a860e6
6 changed files with 23 additions and 13 deletions

View File

@@ -66,14 +66,18 @@ void ExternalGeometryExtension::Restore(Base::XMLReader &reader)
std::unique_ptr<Part::GeometryExtension> ExternalGeometryExtension::copy(void) const
{
std::unique_ptr<ExternalGeometryExtension> cpy = std::make_unique<ExternalGeometryExtension>();
auto cpy = std::make_unique<ExternalGeometryExtension>();
cpy->Ref = this->Ref;
cpy->Flags = this->Flags;
cpy->setName(this->getName()); // Base Class
#if defined (__GNUC__) && (__GNUC__ <=4)
return std::move(cpy);
#else
return cpy;
#endif
}
PyObject * ExternalGeometryExtension::getPyObject(void)