Skip to content

[BUG]: thrust::transform_iterator<F, ...> is broken if F is not copy_assignable #2393

@bernhardmgruber

Description

@bernhardmgruber

Is this a duplicate?

Type of Bug

Silent Failure

Component

Thrust

Describe the bug

If the transformation function object of a thrust::transform_iterator is not copy_assignable (e.g., if it contains a const data member), then thrust::transform_iterator is still copyable, but it will just omit copying the contained transformation function. If the latter contains state, than this state is not copied and the transform iterator gives wrong results.

How to Reproduce

Godbolt: https://godbolt.org/z/qbGxh31qE

Expected behavior

thrust::transform_iterator's special member functions should fail to compile if the corresponding special member function is not supported on the wrapped user-provided function. If the latter is not copyable assignable, the transform iterator should also fail to compile if copy assignment is attempted.

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

Metadata

Metadata

Labels

bugSomething isn't working right.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions