[Issue 17802] New: allocatorObject doesn't set the passed allocator when it has state into impl field of CAllocatorImpl

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 3 16:47:08 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17802

          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 at puremagic.com
          Reporter: stojkovic.igor at 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.

--


More information about the Digitalmars-d-bugs mailing list