www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1531] New: cannot access typedef'd class field

reply d-bugmail puremagic.com writes:

           Summary: cannot access typedef'd class field
           Product: D
           Version: 1.021
          Platform: PC
               URL: http://www.digitalmars.com/d/archives/digitalmars/D/bugs
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: andy.somerville gmail.com

After creating a new type from a class via typedef, an instance of the derived
type cannot access fields of the original class:

  module testTypedef;

  class Foo
          int i;

  typedef Foo Bar;

  void main()
      Bar testBar = new Bar();

compile fails with:
    testTypedef.d(16): Error: this for i needs to be type Foo not type Bar
    testTypedef.d(16): Error: dotvar has no effect in expression (testBar.i)

The problem seems to have already been discussed, but a long time ago
(2005-05-16) and never resolved:


Sep 25 2007
parent d-bugmail puremagic.com writes:

braddr puremagic.com changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

------- Comment #1 from braddr puremagic.com  2007-10-20 03:44 -------
Fixed in 1.022/2.005

Oct 20 2007