← Back to index
|
Original Bugzilla link
Bug 20858 – std.parallelism.task: Can't move value to task param
Status
NEW
Severity
blocker
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2020-05-23T15:37:09Z
Last change time
2024-12-01T16:36:48Z
Assigned to
No Owner
Creator
nin-jin
Moved to GitHub: phobos#10418 →
Comments
Comment #0
by nin-jin — 2020-05-23T15:37:09Z
src\phobos\std\parallelism.d(444,29): Error: struct jin.go.Output!long.Output is not copyable because it is annotated with @disable src\phobos\std\parallelism.d(832,16): Error: template instance std.parallelism.Task!(wrapper, void function(Output!long) @system, Output!long) error instantiating Problem in this phobos code: private static void impl(void* myTask) { import std.algorithm.internal : addressOf; Task* myCastedTask = cast(typeof(this)*) myTask; static if (is(ReturnType == void)) { fun(myCastedTask._args); // !!! } else static if (is(typeof(&(fun(myCastedTask._args))))) { myCastedTask.returnVal = addressOf(fun(myCastedTask._args)); } else { myCastedTask.returnVal = fun(myCastedTask._args); } } See workaround in VibeD to call function with move semantic:
https://github.com/vibe-d/vibe-core/blob/master/source/vibe/core/taskpool.d#L210
mixin(callWithMove!ARGS("c", "args.expand")); // !!! package string callWithMove(ARGS...)(string func, string args) { import std.string; string ret = func ~ "("; foreach (i, T; ARGS) { if (i > 0) ret ~= ", "; ret ~= format("%s[%s]", args, i); static if (needsMove!T) ret ~= ".move"; } return ret ~ ");"; }
Comment #1
by Ajieskola — 2021-08-09T21:23:12Z
Can you show the client code that triggers the compilation errors you showed?
Comment #2
by robert.schadek — 2024-12-01T16:36:48Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/phobos/issues/10418
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB