Nesting a Tid in a struct is interpreted as having local aliasing, though a bare Tid is not.

This doesn't work, though commenting out "receiveOnly!S()" and "tid.send(S(thisTid))" works:
-----
import std.stdio;
import std.concurrency;

void main() {
    auto thread = spawn(function void(Tid tid)
                        {
                            tid.send(thisTid);
                            tid.send(S(thisTid));
                        }, thisTid);
    receiveOnly!Tid();
    receiveOnly!S();
}

struct S {
    Tid tid;
}
-----

$ rdmd test.d
/usr/share/dmd/src/phobos/std/concurrency.d(319): Error: static assert "Aliases to mutable thread-local data not allowed."
../test.d(9):        instantiated from here: send!(S)
Failed: dmd  -v -o- '../test.d' -I'..' >../test.d.deps

Reply via email to