On Monday, 17 July 2017 at 19:30:53 UTC, Jack Stouffer wrote:
On Monday, 17 July 2017 at 17:41:58 UTC, Atila Neves wrote:
On Monday, 17 July 2017 at 14:26:19 UTC, Jack Stouffer wrote:
TL;DR: Issue 17658 [1] makes using shared very annoying/practically impossible.

[...]

I fixed this already, should be in the next release.

Atila

Are you sure? Because DMD nightly still errors:

https://run.dlang.io?compiler=dmd-nightly&source=struct%20A%0A%7B%0A%20%20%20%20this(string%20a)%20%7B%7D%0A%20%20%20%20this(string%20a)%20shared%20%7B%7D%0A%0A%20%20%20%20~this()%20%7B%7D%0A%20%20%20%20~this()%20shared%20%7B%7D%0A%0A%20%20%20%20this(this)%20%7B%7D%0A%20%20%20%20this(this)%20shared%20%7B%7D%0A%7D%0A%0Avoid%20main()%0A%7B%0A%20%20%20%20shared%20f%20%3D%20A(%22%22)%3B%0A%7D


(maybe we should remove the ban on URL shorteners for our own sites)

This works fine in dmd 2.075:

struct A
{
    this(string a) {}
    this(string a) shared {}

    ~this() {}

    this(this T)(this) {} // you can reflect to find out if shared
}

void main()
{
    auto nonShared = A("");
    auto shared_ = shared A("");
    auto nonSharedCopy = nonShared;
    auto sharedCopy = shared_;
}


Atila

Reply via email to