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

algorithm::traverse uses a vector<list<move-only-type>> which isn't guaranteed to work #98

Open
BurningEnlightenment opened this issue Sep 2, 2022 · 0 comments
Labels

Comments

@BurningEnlightenment
Copy link
Collaborator

According to Stephan T. Lavavej container<container<move-only-type>> types are not guaranteed to compile due to a longstanding bug in the C++ Standard. The algorithm::traverse() implementation triggers this defect with MSVC:

list(862): note: while compiling class template member function 'std::list<workitem,std::allocator<workitem>>::list(const std::list<workitem,std::allocator<workitem>> &)'
xmemory(682): note: see reference to function template instantiation 'std::list<workitem,std::allocator<workitem>>::list(const std::list<workitem,std::allocator<workitem>> &)' being compiled
llfio\v2.0\algorithm\../detail/impl/traverse.ipp(580): note: see reference to class template instantiation 'std::list<workitem,std::allocator<workitem>>' being compiled
xmemory(682): error C2280: 'workitem::workitem(const workitem &)': attempting to reference a deleted function
llfio\v2.0\algorithm\../detail/impl/traverse.ipp(172): note: see declaration of 'workitem::workitem'
llfio\v2.0\algorithm\../detail/impl/traverse.ipp(172): note: 'workitem::workitem(const workitem &)': function was explicitly deleted

std::vector<std::list<workitem>> workqueue;

The current workaround is to define a moving copy constructor:

#if _MSC_VER < 1933 // <= VS2022.2
// MSVC's list::splice() always copies :(
workitem(const workitem &o) noexcept
: workitem(const_cast<workitem &&>(std::move(o)))
{
}
#else
workitem(const workitem &) = delete;
#endif

In any case, the workaround selector is too restrictive. It is unclear whether this will be fixed at all, but definitly not earlier than the next MSVC ABI break (see also microsoft/STL#1036).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant