diff options
-rw-r--r-- | clang-tools-extra/clangd/TUScheduler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp index c6b11437d31..795023cfa4f 100644 --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -110,7 +110,10 @@ public: return llvm::None; std::unique_ptr<ParsedAST> V = std::move(Existing->second); LRU.erase(Existing); - return V; + // GCC 4.8 fails to compile `return V;`, as it tries to call the copy + // constructor of unique_ptr, so we call the move ctor explicitly to avoid + // this miscompile. + return llvm::Optional<std::unique_ptr<ParsedAST>>(std::move(V)); } private: |