Bug 19410 – Inconsistency between __traits(allMembers) and __traits(hasMember) for nested structs

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-11-18T10:42:22Z
Last change time
2021-04-17T23:19:31Z
Assigned to
No Owner
Creator
Stanislav Blinov
See also
https://issues.dlang.org/show_bug.cgi?id=19381

Comments

Comment #0 by stanislav.blinov — 2018-11-18T10:42:22Z
void main() { struct S { ~this() {} } foreach (name; __traits(allMembers, S)) static assert(__traits(hasMember, S, name)); } The above will assert: __traits(allMembers) reports that S has a member "this" (the context pointer), but __traits(hasMember) insists that it doesn't. Perhaps "this" could be renamed to "__context", and made visible to __traits(hasMember)?
Comment #1 by boris2.9 — 2021-04-17T23:19:31Z
*** This issue has been marked as a duplicate of issue 14740 ***