Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for nvcc generating copy constructors for classes without ODR-use #2043

Closed
PhilMiller opened this issue Dec 15, 2022 · 1 comment · Fixed by #2044
Closed

Workaround for nvcc generating copy constructors for classes without ODR-use #2043

PhilMiller opened this issue Dec 15, 2022 · 1 comment · Fixed by #2044
Assignees

Comments

@PhilMiller
Copy link
Member

What Needs to be Done?

            instantiation of class "std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> [with _Key=std::string, _Tp=std::unique_ptr<vt::vrt::collection::storage::StoreElmBase, std::default_delete<vt::vrt::collection::storage::StoreElmBase>>, _Hash=std::hash<std::string>, _Pred=std::equal_to<std::string>, _Alloc=std::allocator<std::pair<const std::string, std::unique_ptr<vt::vrt::collection::storage::StoreElmBase, std::default_delete<vt::vrt::collection::storage::StoreElmBase>>>>]" 
            implicit generation of "vt::vrt::collection::storage::Storable::Storable(const vt::vrt::collection::storage::Storable &)" 
            implicit generation of "vt::vrt::collection::Migratable::Migratable(const vt::vrt::collection::Migratable &)" 
            implicit generation of "vt::vrt::collection::Indexable<IndexT>::Indexable(const vt::vrt::collection::Indexable<vt::Index2D> &) [with IndexT=vt::Index2D]" 

That leads down a rabbit hole where nvcc generates a call to the deleted copy constructor for unique_ptr and then fails the compilation. Making any of those classes that mention implicit generation of their copy constructor non-copyable by saying e.g. Storable(Storable const&) = delete; suppresses that misbehavior.

Seen with nvcc from CUDA 11.7

@PhilMiller PhilMiller self-assigned this Dec 15, 2022
@PhilMiller
Copy link
Member Author

There are a few other occurrences of std::[unordered_]map<Foo, unique_ptr<Bar>> in our code, but they all lie in non-template classes that aren't subject to this bogus implicit generation, or are a local variable in a member function, and so not a member to be copied.

PhilMiller added a commit that referenced this issue Dec 15, 2022
nlslatt added a commit that referenced this issue Dec 15, 2022
#2043: Suppress nvcc's bogus implicit generation of a copy constructor for an uncopyable class
cz4rs pushed a commit that referenced this issue Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant