From f3e297d90fc326758ba9043abcdb1d7c5fa0373d Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 18 Mar 2020 13:36:17 +0000 Subject: [PATCH] Fix build with gcc 7.5 by adding a "redundant move" The constructor of Expected expects as T&&, but gcc-7.5 does not infer an rvalue in this context apparently. --- .../LLJITWithLazyReexports/LLJITWithLazyReexports.cpp | 2 +- llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp index 99c3aead224e4..b75d5610f9e64 100644 --- a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp +++ b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) { [](ThreadSafeModule TSM, const MaterializationResponsibility &R) -> Expected { TSM.withModuleDo([](Module &M) { dbgs() << "---Compiling---\n" << M; }); - return TSM; + return std::move(TSM); // Not a redundant move: fix build on gcc-7.5 }); // (3) Create stubs and call-through managers: diff --git a/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp b/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp index 7442fbd3c0a53..6bd8f6144db16 100644 --- a/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp +++ b/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp @@ -191,7 +191,7 @@ Expected ThinLtoJIT::setupMainModule(StringRef MainFunction) { } if (auto TSM = GlobalIndex->parseModuleFromFile(*M)) - return TSM; + return std::move(TSM); // Not a redundant move: fix build on gcc-7.5 return createStringError(inconvertibleErrorCode(), "Failed to parse main module");