Imports incorrectly part of "allMembers" trait output?

Mike Bierlee via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 2 10:56:40 PST 2017


When compiling the following code with DMD 2.072.2:

class LeClass {
	import std.stdio;
}

void main() {
	foreach (memberName; __traits(allMembers, LeClass)) {
		pragma(msg, memberName);
	}
}

The following output is shown in the console:

std
toString
toHash
opCmp
opEquals
Monitor
factory

Note how "std" is part of the output of allMembers. Is this a bug 
or is this intended behavior? I don't think imports are 
necessarily members of a class. It also happens for static 
imports.


More information about the Digitalmars-d-learn mailing list