www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3256] New: getMember static foreach inconsistency

http://d.puremagic.com/issues/show_bug.cgi?id=3256

           Summary: getMember static foreach inconsistency
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: alvcastro yahoo.es


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;

}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 17 2009