www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17802] New: allocatorObject doesn't set the passed allocator


          Issue ID: 17802
           Summary: allocatorObject doesn't set the passed allocator when
                    it has state into impl field of CAllocatorImpl
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: stojkovic.igor gmail.com

Same goes for sharedAllocatorObject. Currently allocatorObject under this:

static if (is(typeof({ A b = a; A c = b; }))) // copyable

finishes with

return cast(CAllocatorImpl!A) emplace!(CAllocatorImpl!A)(state);

I believe it should do this:

auto res = cast(CAllocatorImpl!A) emplace!(CAllocatorImpl!A)(state);
res.impl = a;
return res;

Or CAllocatorImpl should have a constructor which does this and takes a as a
parameter for this case.

Sep 03 2017