Allow copy elision in path concatenation
authorDavid Bolvansky <david.bolvansky@gmail.com>
Wed, 9 May 2018 18:57:17 +0000 (18:57 +0000)
committerDavid Bolvansky <david.bolvansky@gmail.com>
Wed, 9 May 2018 18:57:17 +0000 (18:57 +0000)
Summary:
Just port of libstdc++'s fix to libc++ fs: https://github.com/gcc-mirror/gcc/commit/e6ac4004fe49d785c63bf87aec4b095b5ce1d19f

Author of fix: Jonathan Wakely

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: smeenai, christof, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D46593

llvm-svn: 331910

libcxx/include/experimental/filesystem

index a851824..f29e23e 100644 (file)
@@ -1140,7 +1140,9 @@ bool operator>=(const path& __lhs, const path& __rhs) _NOEXCEPT
 
 inline _LIBCPP_INLINE_VISIBILITY
 path operator/(const path& __lhs, const path& __rhs) {
-    return path(__lhs) /= __rhs;
+    path __result(__lhs);
+    __result /= __rhs;
+    return __result;
 }
 
 template <class _Source>