[Issue 7608] New: __traits(allMembers) is broken for template instances

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 29 03:09:27 PST 2012


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

           Summary: __traits(allMembers) is broken for template instances
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-02-29 03:08:58 PST ---
import std.stdio;

struct Base(bool T)
{
    static if (T)
    {
        int x;
    }

    int y;
}

void main()
{
    alias Base!false Type;
    auto fields = [__traits(allMembers, Type)];

    writeln(fields);  // writes ["x", "y"]
}

"x" does not exist in the Base!false instance.

-- 
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