`thrust::complex`:
* Remove commented out some incorrect and unnecessary constructors and
assignment operators that were added in CUDA 9.2 and commented out in CUDA
10.0.
* Add regression tests for bugs related to the above issue.
* Add missing `__host__ __device__` annotations to a member function to satisfy
GoUDA.
Bug
Bug
MODIFY
thrust/detail/complex/complex.inl
thrust/detail/complex/complex.inl
@@ -25,10 +25,16 @@ namespace thrust
/* --- Constructors --- */
-#if THRUST_CPP_DIALECT < 2011
template <typename T>
__host__ __device__
complex<T>::complex()
+#if THRUST_CPP_DIALECT >= 2011
+ // Initialize the storage in the member initializer list using C++ unicorn
+ // initialization. This allows `complex<T const>` to work.
+ // We do a functional-style cast here to suppress conversion warnings.
+ : data{T(), T()}
+{}
+#else
{
real(T());
imag(T());
@@ -66,10 +72,15 @@ complex<T>::complex(const T& re, const T& im)
}
#endif
-#if THRUST_CPP_DIALECT < 2011
template <typename T>
__host__ __device__
complex<T>::complex(const complex<T>& z)
+#if THRUST_CPP_DIALECT >= 2011
+ // Initialize the storage in the member initializer list using C++ unicorn
+ // initialization. This allows `complex<T const>` to work.
+ : data{z.real(), z.imag()}
+{}
+#else
{
real(z.real());
imag(z.imag());

`thrust::complex`:

* Remove commented out some incorrect and unnecessary constructors and
  assignment operators that were added in CUDA 9.2 and commented out in CUDA
  10.0.
* Add regression tests for bugs related to the above issue.
* Add missing `__host__ __device__` annotations to a member function to satisfy
  GoUDA.

Bug 2341455
Bug 2318871