[Issue 3256] New: getMember static foreach inconsistency

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 17 11:21:22 PDT 2009


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 at puremagic.com
        ReportedBy: alvcastro at 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: -------


More information about the Digitalmars-d-bugs mailing list