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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user