www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1223] New: .tupleof tries to access protected members

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1223

           Summary: .tupleof tries to access protected members
           Product: D
           Version: 1.014
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: hhasemann web.de


.tupleof should only count accessible members, it seems to correctly
handle private ones (with ignoring them) but always tries to access protected
ones, which leads to a "member bar not accessible" error at compile time.
The following example reproduces this error on dmd 1.014:

--- foo.d ---
module foo;
class Foo { protected Foo bar=null; }

--- main.d ---
import foo;

void main() {
  auto test=(new foo).tupleof[0];
}


-- 
May 09 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1223


andrei metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED





I think tupleof should actually access all nonstatic members, or that at least
there should be a way to access all members. It's essentially a way to
unencapsulate objects for e.g. serialization and introspection purposes.


-- 
Feb 16 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1223






I just tested, and it fails with private members too.  Just replace 'protected'
with 'private' in the original and try.

Happens with structs and unions too.


-- 
Feb 25 2008