[Issue 13284] [dmd 2.066-rc2] Cannot match shared classes at receive

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 11 08:24:08 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13284

--- Comment #2 from NCrashed at gmail.com ---
My fault, I've truncated important part while reducing:
```
import std.stdio;
import std.concurrency;
import core.time;
import core.thread;

synchronized class A {}

void thread(Tid parent)
{
    bool stop = false;
    try
    {
        while(!stop)
        {
            receiveTimeout(dur!"msecs"(1000), 
                              (shared A a) 
                              {
                                  writeln("Got a!"); 
                                  parent.send(true); 
                                  stop = true;
                              }
                            , (Variant v) { assert(false, "Unhandled
message!"); });
        }
    } catch(Throwable th)
    {
        writeln(th.toString);
        parent.send(true); 
    }
}

void main()
{
    auto tid = spawn(&thread, thisTid);

    auto a = new shared A();
    tid.send(a);

    receiveOnly!bool();
}
```
The code is printing "Got a!" on 2.065 and fails on 2.066-rc2.

--


More information about the Digitalmars-d-bugs mailing list