diff --git a/sycl/source/detail/adapter_impl.hpp b/sycl/source/detail/adapter_impl.hpp index f2f6b0c3fac16..383f095312117 100644 --- a/sycl/source/detail/adapter_impl.hpp +++ b/sycl/source/detail/adapter_impl.hpp @@ -268,11 +268,12 @@ template class Managed { } Managed &operator=(const Managed &) = delete; Managed &operator=(Managed &&Other) { + URResource Temp = Other.R; + Other.R = nullptr; if (R) Adapter->call(R); + R = Temp; - R = Other.R; - Other.R = nullptr; Adapter = Other.Adapter; return *this; } diff --git a/sycl/source/detail/context_impl.hpp b/sycl/source/detail/context_impl.hpp index 91d10a235d360..0ae3df8dcf397 100644 --- a/sycl/source/detail/context_impl.hpp +++ b/sycl/source/detail/context_impl.hpp @@ -348,7 +348,7 @@ void GetCapabilitiesIntersectionSet(devices_range Devices, CapabilityList.begin(), CapabilityList.end(), DeviceCapabilities.begin(), DeviceCapabilities.end(), std::inserter(NewCapabilityList, NewCapabilityList.begin())); - CapabilityList = NewCapabilityList; + CapabilityList = std::move(NewCapabilityList); } CapabilityList.shrink_to_fit(); }