www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17564] New: std.experimental.allocator.theAllocator is null

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

          Issue ID: 17564
           Summary: std.experimental.allocator.theAllocator is null within
                    shared static this
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: sludwig outerproduct.org

vibe.d needs to use "shared static this" for initialization to support the
original initialization scheme for applications that it still in wide use. With
2.075.0-b1, since processAllocator now returns an ISharedAllocator, it had to
switch to theAllocator where possible. However, since this returns null during
the "shared static this" phase, this causes a crash on startup. Setting
theAllocator to something else also doesn't work, because of an assertion in
std.experimental.allocator.

Proposed change is to make initialization lazy, just as for processAllocator.

--
Jun 28 2017