From b4006f2b7a6dd8357f8f87bb3cad606078dfa9d7 Mon Sep 17 00:00:00 2001 From: dkorpel Date: Fri, 16 Jul 2021 00:45:23 +0200 Subject: [PATCH] Fix issue 22124 - Corrupted closure when compiling with -preview=dip1000 --- src/core/thread/osthread.d | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/thread/osthread.d b/src/core/thread/osthread.d index 2915225865..93bd56a522 100644 --- a/src/core/thread/osthread.d +++ b/src/core/thread/osthread.d @@ -1143,6 +1143,18 @@ unittest thr.join(); } +// https://issues.dlang.org/show_bug.cgi?id=22124 +unittest +{ + Thread thread = new Thread({}); + auto fun(Thread t, int x) + { + t.__ctor({x = 3;}); + return t; + } + static assert(!__traits(compiles, () @nogc => fun(thread, 3) )); +} + unittest { import core.sync.semaphore;