Bug 1531 – cannot access typedef'd class field

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-09-26T00:04:00Z
Last change time
2014-02-17T22:51:10Z
Assigned to
bugzilla
Creator
andy.somerville

Comments

Comment #0 by andy.somerville — 2007-09-26T00:04:46Z
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 { public: int i; } typedef Foo Bar; void main() { Bar testBar = new Bar(); testBar.i; } 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: http://www.digitalmars.com/d/archives/digitalmars/D/bugs/3991.html
Comment #1 by braddr — 2007-10-20T03:44:05Z
Fixed in 1.022/2.005