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