Extra .tupleof field in structs with disabled postblit blocks non-GC-allocation trait

Per Nordlöw per.nordlow at gmail.com
Wed May 9 18:04:40 UTC 2018


On Wednesday, 9 May 2018 at 17:52:48 UTC, Meta wrote:
> I wasn't able to reproduce it on dmd-nightly: 
> https://run.dlang.io/is/9wT8tH
>
> What version of the compiler are you using?

Ahh, the struct needs to be in a unittest block for it to happen:

struct R
{
     @disable this(this);
     int* _ptr;
}
unittest
{
     struct S
     {
         @disable this(this);
         int* _ptr;
     }
     struct T
     {
         int* _ptr;
     }
     pragma(msg, "R: ", typeof(R.tupleof));
     pragma(msg, "S: ", typeof(S.tupleof));
     pragma(msg, "T: ", typeof(T.tupleof));
}

prints

R: (int*)
S: (int*, void*)
T: (int*)

Why is that?


More information about the Digitalmars-d-learn mailing list