Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion std/concurrency.d
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,17 @@ do

thisInfo.ident.mbox.get((T val) {
static if (T.length)
ret.field = val;
{
static if (isAssignable!T)
{
ret.field = val;
}
else
{
import core.lifetime : emplace;
emplace(&ret, val);
}
}
},
(LinkTerminated e) { throw e; },
(OwnerTerminated e) { throw e; },
Expand Down Expand Up @@ -2727,3 +2737,27 @@ auto ref initOnce(alias var)(lazy typeof(var) init, Mutex mutex)
receiveOnly!(bool);
assert(x[0] == 5);
}

// https://issues.dlang.org/show_bug.cgi?id=13930
@system unittest
{
immutable aa = ["0":0];
thisTid.send(aa);
receiveOnly!(immutable int[string]); // compile error
}

// https://issues.dlang.org/show_bug.cgi?id=19345
@system unittest
{
static struct Aggregate { const int a; const int[5] b; }
static void t1(Tid mainTid)
{
const sendMe = Aggregate(42, [1, 2, 3, 4, 5]);
mainTid.send(sendMe);
}

spawn(&t1, thisTid);
auto result1 = receiveOnly!(const Aggregate)();
immutable expected = Aggregate(42, [1, 2, 3, 4, 5]);
assert(result1 == expected);
}