Bug 1874 – __traits(allMembers, T) fails to list methods which only have non-mutating overloads
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-02-27T02:32:00Z
Last change time
2015-06-09T01:14:35Z
Assigned to
bugzilla
Creator
sludwig
Comments
Comment #0 by sludwig — 2008-02-27T02:32:08Z
The method 'const_method' will not be listed by the allMembers trait.
At least one overload has to be present which has neither const or
invariant modifiers.
-------------------
class C {
void mutating_method(){}
const void const_method(){}
void bastard_method(){}
const void bastard_method(int){}
}
import std.stdio;
int main(){
foreach( m; __traits(allMembers, C) )
writefln(m);
return 0;
}
-------------------
Output:
mutating_method
bastard_method
print
toString
toHash
opCmp
opEquals