I was messing about with std.concurrency and ran in to this: http://dpaste.dzfl.pl/5655cbbe

copied out for those who don't want to go to dpaste:

import std.concurrency;
import std.stdio;

void main() {
    double[] a,b;
    a = [1.1];
    b = [2.2];
    int i= 3;

    auto tid = spawn(&foo);
        
    tid.send(a.idup, b.idup);    //works, no problem

    tid.send(a.idup, i);         //so does this

tid.send(a.idup, b.idup, i); //core.exception.AssertError@ std/variant.d(277): target must be non-null

}

void foo() {
    bool running  = true;
    while(running) {
        receive(
            (immutable(double)[] a, int i) {
                writeln(a, i);
            },
            (immutable(double)[] a, immutable(double)[] b, int i) {
                writeln(a, b, i);
            },
            (immutable(double)[] a, immutable(double)[] b) {
                writeln(a, b);
            },
            (OwnerTerminated e) {
                running = false;
            }
        );
    }
}

This seems like a bug to me, but I don't know std.concurrency well enough to be sure.

Reply via email to