[Issue 13894] New: tupleof does not exclude hidden members

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Dec 25 14:16:16 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13894

          Issue ID: 13894
           Summary: tupleof does not exclude hidden members
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: spec, wrong-code
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: thecybershadow at gmail.com

>From the spec:

> The .tupleof property returns an ExpressionTuple of all the fields in the class, excluding the hidden fields and the fields in the base class.

However, .tupleof seems to include non-static structs' hidden field:

///////////////// test.d ////////////////
void fun()
{
    struct S
    {
        int i;
        void m() { }
    }

    S s;
    static assert(s.tupleof.length == 1);
}
/////////////////////////////////////////

This also seems to affect writeln: `writeln(s)` will print "S(0, null)".

--


More information about the Digitalmars-d-bugs mailing list