Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make!T (and likely emplace!T) do not work for some shared types #10388

Open
dlangBugzillaToGithub opened this issue Sep 21, 2019 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

htvennik reported this on 2019-09-21T10:03:47Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=20234

Description

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.

!!!There are attachements in the bugzilla issue that have not been copied over!!!

@dlangBugzillaToGithub
Copy link
Author

htvennik commented on 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.

@LightBender LightBender removed the P3 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants