Skip to content

Commit

Permalink
Revert "Fix issue 13930, 19345 - Fix receiveOnly for non-assignable t…
Browse files Browse the repository at this point in the history
…ypes"

This reverts commit 4f4fef1.
  • Loading branch information
Geod24 authored and dlang-bot committed Oct 10, 2020
1 parent 4f4fef1 commit 4cf520b
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions std/concurrency.d
Original file line number Diff line number Diff line change
Expand Up @@ -802,17 +802,7 @@ do

thisInfo.ident.mbox.get((T val) {
static if (T.length)
{
static if (isAssignable!T)
{
ret.field = val;
}
else
{
import core.lifetime : emplace;
emplace(&ret, val);
}
}
ret.field = val;
},
(LinkTerminated e) { throw e; },
(OwnerTerminated e) { throw e; },
Expand Down Expand Up @@ -2737,27 +2727,3 @@ 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);
}

0 comments on commit 4cf520b

Please sign in to comment.