[Issue 17057] New: trait "allMembers" incorrectly includes imports

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jan 3 05:27:22 PST 2017


https://issues.dlang.org/show_bug.cgi?id=17057

          Issue ID: 17057
           Summary: trait "allMembers" incorrectly includes imports
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: m.bierlee at lostmoment.com

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.

--


More information about the Digitalmars-d-bugs mailing list