https://github.com/SunilKuravinakop created 
https://github.com/llvm/llvm-project/pull/75562

When building with gcc-7.5 we get the error:
`nochange/openmp/libomptarget/src/PluginManager.cpp: In static member function 
'static llvm::Expected<std::unique_ptr<PluginAdaptorTy> > 
PluginAdaptorTy::create(const string&)':
`
To overcome this an std::move has been added to convert from 
`std::unique_ptr<PluginAdaptorTy> to Expected<std::unique_ptr<PluginAdaptorTy>>`
This problem does not occur in higher versions of the compiler like gcc-12.2

>From 07d34ffbeff6563839695bf5c374b75cf3fe3d6d Mon Sep 17 00:00:00 2001
From: Sunil Kuravinakop <kurav...@pe28vega.us.cray.com>
Date: Thu, 14 Dec 2023 04:09:12 -0600
Subject: [PATCH] Adding an std::move to convert from
 std::unique_ptr<PluginAdaptorTy> to
 Expected<std::unique_ptr<PluginAdaptorTy>>.   Changes to be committed:  
 modified:   openmp/libomptarget/src/PluginManager.cpp

---
 openmp/libomptarget/src/PluginManager.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/openmp/libomptarget/src/PluginManager.cpp 
b/openmp/libomptarget/src/PluginManager.cpp
index 17787284441c55..c336eac7ab22f8 100644
--- a/openmp/libomptarget/src/PluginManager.cpp
+++ b/openmp/libomptarget/src/PluginManager.cpp
@@ -47,7 +47,9 @@ PluginAdaptorTy::create(const std::string &Name) {
       new PluginAdaptorTy(Name, std::move(LibraryHandler)));
   if (auto Err = PluginAdaptor->init())
     return Err;
-  return PluginAdaptor;
+  Expected<std::unique_ptr<PluginAdaptorTy>> ExpPluginAdaptor(
+      std::move(PluginAdaptor));
+  return ExpPluginAdaptor;
 }
 
 PluginAdaptorTy::PluginAdaptorTy(const std::string &Name,

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to