Bug 14893 – std.concurrency: can't send shared arrays or shared structs

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-09T21:04:17Z
Last change time
2017-08-16T14:59:17Z
Assigned to
No Owner
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2015-08-09T21:04:17Z
Shared array: ---- void main() { shared int[] x; import std.concurrency; send(thisTid, x); } ---- /home/test/d/dmd2/linux/bin64/../../src/phobos/std/variant.d(319): Error: cannot implicitly convert expression (*src) of type shared(int)[] to const(int)[] /home/test/d/dmd2/linux/bin64/../../src/phobos/std/variant.d(619): Error: function core.stdc.string.memcpy (void* s1, const(void*) s2, ulong n) is not callable using argument types (ubyte[32]*, shared(int)*, ulong) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/variant.d(420): Error: template instance std.variant.VariantN!32LU.VariantN.opAssign!(shared(int)) error instantiating /home/test/d/dmd2/linux/bin64/../../src/phobos/std/variant.d(638): instantiated from here: handler!(shared(int)[]) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/variant.d(554): instantiated from here: opAssign!(shared(int)[]) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/concurrency.d(117): instantiated from here: __ctor!(shared(int)[]) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/concurrency.d(628): ... (2 instantiations, -v to show) ... /home/test/d/dmd2/linux/bin64/../../src/phobos/std/concurrency.d(594): instantiated from here: _send!(shared(int[])) test.d(5): instantiated from here: send!(shared(int[])) ---- Shared struct: ---- struct S {} void main() { shared S x; import std.concurrency; send(thisTid, x); } ---- /home/test/d/dmd2/linux/bin64/../../src/phobos/std/variant.d(619): Error: function core.stdc.string.memcpy (void* s1, const(void*) s2, ulong n) is not callable using argument types (ubyte[32]*, shared(S)*, ulong) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/variant.d(554): Error: template instance std.variant.VariantN!32LU.VariantN.opAssign!(shared(S)) error instantiating /home/test/d/dmd2/linux/bin64/../../src/phobos/std/concurrency.d(117): instantiated from here: __ctor!(shared(S)) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/concurrency.d(628): instantiated from here: __ctor!(shared(S)) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/concurrency.d(618): instantiated from here: _send!(shared(S)) /home/test/d/dmd2/linux/bin64/../../src/phobos/std/concurrency.d(594): instantiated from here: _send!(shared(S)) test.d(6): instantiated from here: send!(shared(S)) ----
Comment #1 by dfj1esp02 — 2015-08-10T12:35:05Z
Probably Variant supports too many questionable operations on shared arrays. Those should be only stored and retrieved.
Comment #2 by schveiguy — 2017-08-16T14:59:17Z
This really has the same root causes as 13262. *** This issue has been marked as a duplicate of issue 13262 ***