[dmd-internals] [D-Programming-Language/dmd] 6ef6b7: Fixes Issue 5385 - Access must be checked for stat...

Rainer Schuetze r.sagitario at gmx.de
Sat Dec 22 13:25:04 PST 2012


On 22.12.2012 12:02, kenji hara wrote:
 >
 > Using tupleof can be a workaround.
 >

Thanks for the hint, this now works:

bool listMembers(T)()
{
     static if (is(T P == super))
         static if(P.length > 0)
             listMembers!(P[0])();
		
     alias typeof(T.tupleof) TTypes;
     foreach(i, _; TTypes)
     {
         enum cur_offset = T.tupleof[i].offsetof;
         alias TTypes[i] U;

         pragma(msg,"  field " ~ T.tupleof[i].stringof ~ " : " ~ 
U.stringof);
     }
}

No mixins anymore, and even a bug fixed, because a field was not dealt 
with if a derived class has a field with the same name 
(__traits(allMembers) returns it only once).

BTW: Is there a way to alias T.tupleof for faster CTFE execution and 
less memory usage?



More information about the dmd-internals mailing list