Bug 23951 – "alias this" not properly dereferenced when the object being looked up is a field of a type

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-06-01T09:54:57Z
Last change time
2023-07-15T15:30:04Z
Keywords
pull
Assigned to
No Owner
Creator
Eyal

Comments

Comment #0 by eyal — 2023-06-01T09:54:57Z
struct S { int x; } struct T { S a; alias a this; } struct U { T t; } static assert(__traits(hasMember, T, "x")); static assert(__traits(hasMember, T.init, "x")); static assert(__traits(hasMember, U.init.t, "x")); static assert(__traits(hasMember, U.t, "a")); static assert(__traits(hasMember, U.t, "x")); // only assertion that fails! if U.t has a type (T), then it should also have access to "x", in the same way.
Comment #1 by dlang-bot — 2023-07-12T14:34:08Z
@RazvanN7 created dlang/dmd pull request #15406 "Fix Issue 23951 - traits(getMember) does not follow alias this" fixing this issue: - Fix Issue 23951 - traits(getMember) does not follow alias this https://github.com/dlang/dmd/pull/15406
Comment #2 by dlang-bot — 2023-07-14T11:34:13Z
dlang/dmd pull request #15406 "Fix Issues 23951 and 23279 - traits(hasMember) does not follow alias this + ICE when using traits(hasMember) on an erroneous member" was merged into stable: - b62b5066b4c797af42500be0ef6cca804c779e30 by RazvanN7: Fix Issue 23951 - traits(getMember) does not follow alias this https://github.com/dlang/dmd/pull/15406
Comment #3 by dlang-bot — 2023-07-15T15:30:04Z
dlang/dmd pull request #15417 "merge stable" was merged into master: - 452e170d2ad0c547dd1a4fe45e21af0cde87565c by Razvan Nitu: Fix Issues 23951 and 23279 - traits(hasMember) does not follow alias this + ICE when using traits(hasMember) on an erroneous member (#15406) * Fix Issue 23951 - traits(getMember) does not follow alias this * Fix Issue 23279 - ICE when using traits(hasMember) with an erroneous member https://github.com/dlang/dmd/pull/15417