diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 94f08c22a4f..cdbc44ecdf5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2018-05-07 Jonathan Wakely + + PR libstdc++/85671 + * include/bits/fs_path.h (operator/): Permit copy elision. + * include/experimental/bits/fs_path.h (operator/): Likewise. + 2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net> Moar PR libstdc++/80506 diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index 31c34d67c75..6703e9167e4 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -552,7 +552,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 diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h index 456452bb317..3b4011e6414 100644 --- a/libstdc++-v3/include/experimental/bits/fs_path.h +++ b/libstdc++-v3/include/experimental/bits/fs_path.h @@ -510,7 +510,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