foonathan / memory

STL compatible C++ memory allocator library using a new RawAllocator concept that is similar to an Allocator but easier to use and write.
https://memory.foonathan.net
zlib License
1.5k stars 195 forks source link

problem with std::is_abstract for unique_ptr with allocator inside struct definition #153

Closed demihamster closed 1 year ago

demihamster commented 1 year ago

Hi, not sure if I'm somehow at fault but - minimal example doesn't compile with visual studio 2019: VC\Tools\MSVC\14.29.30133\include\type_traits(517,36): error C2139: 'Node': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_abstract'

happens because Node is not yet defined when the deleter checks with assertion if the type is abstract

namespace mem = foonathan::memory;
using allocator_t = mem::memory_pool<>;

struct Node
{
    int v;
    using partition_t = mem::unique_ptr<Node, allocator_t>; 
    partition_t ptr;
};
foonathan commented 1 year ago

Good catch, should be fixed now.