-
-
Notifications
You must be signed in to change notification settings - Fork 84
Description
I initially didnt catch that cuda::memory::host::make_unique_span and cuda::memory::device::make_unique_span do not both return the same type due to the different deleter required for the device span. I missed it because of the identically-named but differently-defined using unique_span = ... aliases for device/host.
My issue arose when I assigned the results of both those calls to an object of type cuda::unique_span<T>.
Even though copy-constructors are explicitly deleted, unique_span has a ctor which accepts a std::span as a copy:
explicit unique_span(span_type span) noexcept : span_type{span} { }
Since a cuda::memory::device::unique_span is not technically the same type as cuda::unique_span, the deleted copy constructor is ignored, and since the unique_span types extend std::span, that unique_span(span_type span) constructor is called, ending up with two unique_spans "owning" the data
A fix for this would probably add an explicit deleted constructor for any unique_span type rather than just a deleted ctor for the same unique_span type:
template<typename OtherT, typename OtherDeleter>
explicit unique_span(const unique_span<OtherT, OtherDeleter>&) = delete;