From 6e6e024fa3776ffb6da36c97c363288de4c321da Mon Sep 17 00:00:00 2001 From: Paul Backus Date: Thu, 25 Feb 2021 12:42:22 -0500 Subject: [PATCH] Fix issue 21663 - std.concurrency.receiveOnly doesn't work with tuples --- std/concurrency.d | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/std/concurrency.d b/std/concurrency.d index 92fda87ee..e2089bcd6 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -796,6 +796,7 @@ in do { import std.format : format; + import std.meta : allSatisfy; import std.typecons : Tuple; Tuple!(T) ret; @@ -803,7 +804,7 @@ do thisInfo.ident.mbox.get((T val) { static if (T.length) { - static if (isAssignable!T) + static if (allSatisfy!(isAssignable, T)) { ret.field = val; } @@ -888,6 +889,12 @@ do assert(result == "Unexpected message type: expected 'string', got 'int'"); } +// https://issues.dlang.org/show_bug.cgi?id=21663 +@safe unittest +{ + alias test = receiveOnly!(string, bool, bool); +} + /** * Receives a message from another thread and gives up if no match * arrives within a specified duration.