Is this a bug with __traits(derivedMembers)?
ag0aep6g
anonymous at example.com
Tue Jun 12 14:37:19 UTC 2018
On Tuesday, 12 June 2018 at 13:40:45 UTC, bauss wrote:
> See the following: https://run.dlang.io/is/uQ21PH
>
> (I have tried with allMembers too.)
>
> It's like it won't pick up the member that is added using a
> mixin at line 22.
>
> ```
> mixin("ubyte[" ~ to!string(__PADDING_SIZE__) ~ "] __PADDING__"
> ~ member ~ ";");
> ```
It's because the identifier starts with two underscores. Such
identifiers are reserved for internal use, and apparently they're
ignored by some (all?) __traits.
I'm not sure if this can count as a bug, but it doesn't look just
fine either.
Smaller test case:
----
struct S
{
int foo, __bar, baz;
}
pragma(msg, __traits(allMembers, S)); /* tuple("foo", "baz") */
----
More information about the Digitalmars-d
mailing list