diff --git a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp index 88bab18169a8..2cae847e7657 100644 --- a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp +++ b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp @@ -221,7 +221,7 @@ llvm::Expected> clang::DirectoryWatcher::creat // We need to copy the data so the lifetime is ok after a const copy is made // for the block. - const std::string CopiedPath = Path; + const std::string CopiedPath = Path.str(); auto InitWork = ^{ // We need to start watching the directory before we start scanning in order