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

Ambiguous overloads of reinterpret_tag #10

Closed
bryancatanzaro opened this issue Mar 28, 2012 · 2 comments
Closed

Ambiguous overloads of reinterpret_tag #10

bryancatanzaro opened this issue Mar 28, 2012 · 2 comments

Comments

@bryancatanzaro
Copy link

I run into an ambiguous overload of reinterpret_tag when trying to invoke thrust::copy on thrust::detail::pointer objects which are both tagged with the thrust::system::omp::tag. This error does not occur when both pointers are tagged with thrust::system::cuda::tag. It also does not occur when pointers have different tags (i.e., one is from omp and one from cuda).

#include <thrust/copy.h>
#include <thrust/detail/pointer.h>
#include <thrust/system/omp/memory.h>
#include <thrust/system/cuda/memory.h>

//#define ERROR

int main() {
#ifdef ERROR
    typedef thrust::system::omp::tag my_tag;
#else
    typedef thrust::system::cuda::tag my_tag;
#endif

    thrust::pointer<int, my_tag> a_begin((int*)NULL);
    thrust::pointer<int, my_tag> b_begin((int*)NULL);
    thrust::copy(a_begin, a_begin,
                 b_begin);
}

The error message indicates the problem comes from

/Users/catanzar/thrust/thrust/system/omp/detail/copy.inl(60): error: more than one instance of overloaded function
"thrust::reinterpret_tag" matches the argument list:
    function template "thrust::pointer<T, Tag, thrust::use_default, thrust::use_default> thrust::reinterpret_tag<Tag,T,OtherTag>
        (thrust::pointer<T, OtherTag, thrust::use_default, thrust::use_default>)"
    function template "thrust::detail::enable_if_retaggable<OtherTag, Tag, thrust::pointer<T, Tag, thrust::use_default, 
        thrust::use_default>>::type thrust::reinterpret_tag<Tag,T,OtherTag>(thrust::pointer<T, OtherTag, thrust::use_default,
        thrust::use_default>)"
    argument types are: (thrust::pointer<int, thrust::system::omp::detail::tag, thrust::use_default, thrust::use_default>)
@jaredhoberock
Copy link
Contributor

// specialization for thrust::pointer
template<typename Tag, typename T, typename OtherTag>
thrust::pointer<T,Tag> reinterpret_tag(thrust::pointer<T,OtherTag> ptr)
{
 return reinterpret_tag<Tag>(ptr.get());
} // end reinterpret_tag()

should instead be

// specialization for thrust::pointer
template<typename Tag, typename T, typename OtherTag, typename Reference, typename Derived>
thrust::pointer<T,Tag> reinterpret_tag(thrust::pointer<T,OtherTag,Reference,Derived> ptr)
{
  return reinterpret_tag<Tag>(ptr.get());
} // end reinterpret_tag()

@bryancatanzaro
Copy link
Author

Yes, this resolves the issue on my side.

kshitij12345 pushed a commit to kshitij12345/thrust that referenced this issue Mar 24, 2022
Update download link to 0.9.3

Former-commit-id: a30ae557a7208a813ea304ac66c509b6b420952c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants