Bug 17057 – trait "allMembers" incorrectly includes imports

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2017-01-03T13:27:00Z
Last change time
2017-03-22T12:21:27Z
Assigned to
nobody
Creator
m.bierlee

Comments

Comment #0 by m.bierlee — 2017-01-03T13:27:22Z
For the following code: class LeClass { import std.stdio; } void main() { foreach(member; __traits(allMembers, LeClass)) { pragma(msg, member); } } The compilation output will be: std toString toHash opCmp opEquals Monitor factory Note how "std" is there. This one is added due to the import statement being there. This inclusion is unusable and incorrect since an import statement is not a member of a class.
Comment #1 by github-bugzilla — 2017-01-30T16:09:15Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/912252b50277b95964981ef197d708db662b6554 Fix Issue 17057 - Added test file https://github.com/dlang/dmd/commit/6280bb4437c05f418e852dad65c7f09ae2b43dd7 Merge pull request #6505 from RazvanN7/Issue_17057 Fix Issue 17057 - trait allMembers incorrectly includes imports
Comment #2 by github-bugzilla — 2017-02-24T20:34:29Z
Comment #3 by github-bugzilla — 2017-03-22T12:21:27Z