You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Digging into this, I see the allocator is only "stored" by reinterpret_casting the manager in manager_storage_type. Is that an oversight or deliberate? I suppose it works for stateless allocators but not if they have any contents (or vtables). Now I'm
questioning how some of my code ever worked at all.
I suppose the solution is to use the allocator to allocate space for itself, or just add a char[] block in manager_storage_type and static_assert that the allocator does not exceed that size.
The following code causes a segfault:
However, creating a single
function
with the pmr allocator does not:func::function<void()> f { std::allocator_arg, std::pmr::polymorphic_allocator<> { }, [] { } };
And this also works:
Possibly related to #2 somehow, but
std::pmr::polymorphic_allocator
has no virtual destructor.The text was updated successfully, but these errors were encountered: