www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17057] New: trait "allMembers" incorrectly includes imports

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 puremagic.com
          Reporter: m.bierlee 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.

--
Jan 03