[Issue 9122] std.concurrency send() fails with multiple arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 23 11:45:46 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9122
Tavi Cacina <octavian.cacina at outlook.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |octavian.cacina at outlook.com
--- Comment #5 from Tavi Cacina <octavian.cacina at outlook.com> 2013-04-23 11:45:43 PDT ---
I hit this bug too as I wanted to send a structure. Martin Krejcirik was right
about the size of the structure. As soon as the message to be sent exceeds 20
bytes (win32) it comes to the assert. I see that the problem is with the
default generated opAssign for the struct Message in std.concurrency. This
Message has a "Variant data" attribute that needs to be copied.
I could reproduce the error like this:
---
struct S { int p1, p2, p3, p4, p5, p6; }
Variant v1 = S();
Variant v2;
v2 = v1; // assert
---
The Variant is defined like:
alias VariantN!(maxSize!(creal, char[], void delegate())) Variant;
so it has already a fixed size. The constructor can cope with the bigger size
and will adjust, but the opAssign does not. I do not know if it is a bug that
the constructor allows it or that the opAssign does not.
A possible fix would be to add an opAssign operator to the Message structure:
---
ref Message opAssign(Message rhs)
{
type = rhs.type;
swap(data, rhs.data);
return this;
}
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list