Despite of the fact that std.experimental.allocator.mallocator allocators (aligned and malloc) don't allocate on the gc-heap, they can't be used in @nogc functions.
for example:
~~~~~~~~~~~~~~~~~
auto myAlloc(size_t size) @nogc
{
import std.experimental.allocator.mallocator;
return Mallocator.instance.allocate(size);
}
void main(string[] args)
{
myAlloc(10);
}
~~~~~~~~~~~~~~~~~
> /tmp/temp_7FFA2DEB9BF0.d(8,40): Error: @nogc function 'runnable.myAlloc' cannot call non-@nogc function 'std.experimental.allocator.mallocator.Mallocator.allocate'
Comment #1 by github-bugzilla — 2015-12-07T05:51:45Z