Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

cub::TransformInputIterator should not define operator->() #377

Closed
zasdfgbnm opened this issue Sep 20, 2021 · 0 comments · Fixed by #378
Closed

cub::TransformInputIterator should not define operator->() #377

zasdfgbnm opened this issue Sep 20, 2021 · 0 comments · Fixed by #378
Assignees
Labels
P2: nice to have Desired, but not necessary. type: bug: functional Does not work as intended.
Milestone

Comments

@zasdfgbnm
Copy link
Contributor

See:

// nvcc --extended-lambda cub-debug.cu

#include <cub/cub.cuh>

struct Result {
    int64_t value;
};

int main() {
    int64_t a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    auto wrap = [] __host__ __device__ (int64_t a) -> Result { return {a}; };
    cub::TransformInputIterator<Result, decltype(wrap), int64_t *, ptrdiff_t> iter(a, wrap);
    assert((*(iter + 2)).value == 2);

    // The following code does not compile:
    // assert((iter + 2)->value == 2);
    //
    // Error is:
    // /usr/local/cuda/bin/../targets/x86_64-linux/include/cub/iterator/transform_input_iterator.cuh:225:24: error: taking address of rvalue [-fpermissive]
    // 225 |         return &conversion_op(*input_itr);
    //     |         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
  
}
@alliepiper alliepiper added type: bug: functional Does not work as intended. P2: nice to have Desired, but not necessary. labels Oct 6, 2021
@alliepiper alliepiper added this to the 1.15.0 milestone Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2: nice to have Desired, but not necessary. type: bug: functional Does not work as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants