www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13894] New: tupleof does not exclude hidden members

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 puremagic.com
          Reporter: thecybershadow 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)". --
Dec 25 2014