← Back to index
|
Original Bugzilla link
Bug 3256 – getMember static foreach inconsistency
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-08-17T11:21:00Z
Last change time
2015-06-09T01:28:07Z
Assigned to
nobody
Creator
alvcastro
Comments
Comment #0
by alvcastro — 2009-08-17T11:21:21Z
final class D { static void m1(){ writeln("VOmito 1"); } static void m2(){ writeln("VOmito 2"); } static void m3(){ writeln("VOmito 3"); } } template Tuple(E...) { alias E Tuple; } template MembersTuple(D, int i = 0) { static if (__traits(derivedMembers, D).length > i) { alias Tuple!(__traits(derivedMembers, D)[i], .MembersTuple!(D,i+1)) MembersTuple; } else { alias Tuple!() MembersTuple; } } int main (string[] args) { alias MembersTuple!(D) dMem; foreach( i, member ; dMem ) { __traits(getMember, D, dMem[i] )(); // -> Compiles __traits(getMember, D, member )(); // -> Doesn't compile } return 0; }
Comment #1
by yebblies — 2011-06-12T14:05:04Z
Closing as this works now (dmd2.053)
Comment #2
by kennytm — 2011-06-12T14:40:33Z
I think we should create a unit-test for every "turns out it works now" bug.
Comment #3
by yebblies — 2011-06-12T14:47:08Z
Probably not a bad idea. I'll start shoving the ones I close into a file.