An Issue I Wish To Raise Awareness On

Arek via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 12 12:34:35 PDT 2017


On Friday, 21 July 2017 at 08:53:44 UTC, Atila Neves wrote:

>
> 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

This look interesting: this(this T)(this) {}
What is it? Postblit?

It compiles but doesn't work for me.

this(this T)(this) {writeln("postblit"); }   // doesn't print 
anything

Arek


More information about the Digitalmars-d mailing list