[Issue 1531] New: cannot access typedef'd class field
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 25 22:04:48 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1531
Summary: cannot access typedef'd class field
Product: D
Version: 1.021
Platform: PC
URL: http://www.digitalmars.com/d/archives/digitalmars/D/bugs
/3991.html
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: andy.somerville at 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
{
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
--
More information about the Digitalmars-d-bugs
mailing list