From 9fb2606c8819d7aff27ca62a1936bb75d8aef12f Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Mon, 1 Apr 2019 13:26:18 +0200 Subject: [PATCH] Enable RVO for any other than old GCCs like 4.8 --- src/Mod/Part/App/GeometryDefaultExtension.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/App/GeometryDefaultExtension.cpp b/src/Mod/Part/App/GeometryDefaultExtension.cpp index bc0ba91996..86effad2a0 100644 --- a/src/Mod/Part/App/GeometryDefaultExtension.cpp +++ b/src/Mod/Part/App/GeometryDefaultExtension.cpp @@ -81,7 +81,11 @@ std::unique_ptr GeometryDefaultExtension::copy(void) cpy->value = this->value; cpy->setName(this->getName()); - return std::move(cpy); + #if defined(__GNUC__) && __GNUC__ < 7 + return std::move(cpy); // GCC 4.8 bug + #else + return cpy; // all the others use RVO optimization perfectly fine. + #endif // Advise from Scott Meyers Effective Modern c++: // // Don't std::move(cpy); RVO optimization Item 25, if the compiler fails to elide, would have to move it anyway