Created attachment 1760
Patch fixing this issue
This is like a special case of Issue 20046, caused by a wrong instantiation of emplaceRef. I spent days trying to find a minimal test case, but no success.
The error can easily be reproduced with a unittest build of https://github.com/thaven/OneFile
(This issue is currently blocking a first release of that package)
The unittest build will produce output like:
----
$ dub test -f
Generating test runner configuration 'onefile-test-library' for 'library' (library).
Performing "unittest" build using /usr/bin/dmd for x86_64.
onefile ~master: building configuration "onefile-test-library"...
/usr/include/dmd/phobos/std/conv.d(4419,19): Error: function core.stdc.string.memcpy(return void* s1, scope const(void*) s2, ulong n) is not callable using argument types (shared(Root)*, immutable(Root)*, ulong)
/usr/include/dmd/phobos/std/conv.d(4419,19): cannot pass argument &chunk of type shared(Root)* to parameter return void* s1
/usr/include/dmd/phobos/std/conv.d(4339,27): Error: template instance std.conv.emplaceInitializer!(shared(Root)) error instantiating
/usr/include/dmd/phobos/std/experimental/allocator/package.d(1178,29): instantiated from here: emplaceRef!(shared(Root), shared(Root))
source/onefile/stm.d(1218,39): instantiated from here: make!(shared(Root), shared(AlignedMallocator))
source/onefile/container/slist.d(223,40): instantiated from here: tmMake!(shared(Root))
source/onefile/container/slist.d(675,18): instantiated from here: SList!uint
/usr/include/dmd/phobos/std/experimental/allocator/package.d(1190,53): Error: forward reference to inferred return type of function call function () @trusted
{
alloc.deallocate(m);
}
()
<...snip...>
----
The attached patch to Phobos fixes the problem. (Also to be found at https://github.com/dlang/phobos/compare/master...thaven:fix/make-emplace-shared)
Any help finding the exact trigger for the bug, and thus a minimal test case, is appreciated.
Comment #1 by htvennik — 2020-02-15T10:02:18Z
Comment on attachment 1760
Patch fixing this issue
The patch is incorrect. Don't know how it could even work for my project, as it effectively removes qualifiers from the return type of make!T.
Comment #2 by robert.schadek — 2024-12-01T16:35:38Z