From: Jonathan Wakely Date: Wed, 4 Jul 2018 13:59:06 +0000 (+0100) Subject: PR libstdc++/85671 allow copy elision in path concatenation X-Git-Tag: releases/gcc-7.4.0~285 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8fbe558101c52bf3ece5d71634c5380da73c310;p=thirdparty%2Fgcc.git PR libstdc++/85671 allow copy elision in path concatenation By performing the /= operation on a named local variable instead of a temporary the copy made for the return value can be elided. Backport from mainline 2018-05-07 Jonathan Wakely PR libstdc++/85671 * include/experimental/bits/fs_path.h (operator/): Likewise. From-SVN: r262404 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9ca215ed0777..2f874dfe5f25 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2018-07-04 Jonathan Wakely + Backport from mainline + 2018-05-07 Jonathan Wakely + + PR libstdc++/85671 + * include/experimental/bits/fs_path.h (operator/): Likewise. + Backport from mainline 2018-06-14 Daniel Trebbien Jonathan Wakely diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h index 512167f6f2d7..aa4949c5e24b 100644 --- a/libstdc++-v3/include/experimental/bits/fs_path.h +++ b/libstdc++-v3/include/experimental/bits/fs_path.h @@ -509,7 +509,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 /// Append one path to another inline path operator/(const path& __lhs, const path& __rhs) - { return path(__lhs) /= __rhs; } + { + path __result(__lhs); + __result /= __rhs; + return __result; + } /// Write a path to a stream template