Skip to content

[BUG]: cuda::std::uninitialized_copy_n fails to copy thrust device vectors #5490

Open

Description

@bernhardmgruber

Is this a duplicate?

Type of Bug

Compile-time Error

Component

libcu++

Describe the bug

Code below fails to compile

#include <thrust/device_vector.h>
#include <cuda/std/__memory/uninitialized_algorithms.h>

int main() {
    thrust::device_vector<int> v1(10);
    thrust::device_vector<int> v2(10, thrust::no_init);
    cuda::std::uninitialized_copy_n(v1.begin(), 10, v2.begin());

    return 0;
}

How to Reproduce

https://cuda.godbolt.org/z/b1o1f6dff

Expected behavior

It should compile and work

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

Activity

  1. miscco commented on Aug 11, 2025

    @miscco
    Contributor

    This is more or less intended.

    The reason being that we should not try to take the address of a temporary, or try to remove it.

    This is going to be nontrivial, as we need a generic way to sniff out that this type is a proxy iterator and then delete the underlying object

  2. bernhardmgruber commented on Aug 12, 2025

    @bernhardmgruber
    ContributorAuthor

    If you tell me this is intended behavior, then this is fine. We could diagnose this nicer though.

  3. miscco commented on Aug 12, 2025

    @miscco
    Contributor

    I believe we should support this. The actual problem is that device_ptr iss effectively a contiguous iterator but does not implement all the necessary things

  4. added theissue type on Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

  • Status
    Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions