File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -648,3 +648,27 @@ void TestExclusiveScanWithBigIndexes()
648648
649649DECLARE_UNITTEST (TestExclusiveScanWithBigIndexes);
650650
651+ #if THRUST_CPP_DIALECT >= 2011
652+
653+ struct Int {
654+ int i{};
655+ __host__ __device__ explicit Int (int num) : i(num) {}
656+ __host__ __device__ Int () : i{} {}
657+ __host__ __device__ Int operator +(Int const & o) const { return Int{this ->i + o.i }; }
658+ };
659+
660+ void TestInclusiveScanWithUserDefinedType ()
661+ {
662+ thrust::device_vector<Int> vec (5 , Int{1 });
663+
664+ thrust::inclusive_scan (
665+ thrust::device,
666+ vec.cbegin (),
667+ vec.cend (),
668+ vec.begin ());
669+
670+ ASSERT_EQUAL (static_cast <Int>(vec.back ()).i , 5 );
671+ }
672+ DECLARE_UNITTEST (TestInclusiveScanWithUserDefinedType);
673+
674+ #endif // c++11
You can’t perform that action at this time.
0 commit comments