| |
| Posted by Paul Backus in reply to Per Nordlöw | PermalinkReply |
|
Paul Backus
Posted in reply to Per Nordlöw
| On Saturday, 2 March 2024 at 19:29:47 UTC, Per Nordlöw wrote:
> On Saturday, 2 March 2024 at 19:28:08 UTC, Per Nordlöw wrote:
> On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote:
> Not according to run.dlang.io, for all available DMD versions. Perhaps your tested S was nested in some function/aggregate and so had an implicit context pointer.
Ahh. Yes. Indeed. My mistake. Thanks.
Thanks. Neither my websearches nor ChatGPT plus couldn't figure that out.
FYI, you can dump the layout of a struct, including hidden fields, by iterating over its .tupleof property:
void main()
{
struct S
{
@disable this(this);
int n;
}
static foreach (field; S.tupleof)
pragma(msg,
typeof(field).stringof, " ",
__traits(identifier, field), " ",
"at ", field.offsetof
);
}
This example prints out
int n at 0LU
void* this at 8LU
|