digitalmars.D.bugs - [Issue 14016] New: Nested inherited class doesn't know the type of
- via Digitalmars-d-bugs (41/42) Jan 20 2015 https://issues.dlang.org/show_bug.cgi?id=14016
https://issues.dlang.org/show_bug.cgi?id=14016 Issue ID: 14016 Summary: Nested inherited class doesn't know the type of its outer object Product: D Version: D1 & D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: andrej.mitrovich gmail.com ----- class A { class NestedA { } } class B : A { int field; class NestedB : NestedA { void foo ( ) { this.outer.field = 1; // disallowed (cast(B)this.outer).field = 1; // workaround } } } void main ( ) { } ----- $ dmd test.dtest.d(14): Error: no property 'field' for type 'test.A'I think the first line should work. AFAIK NestedB can only be instantiated with an outer type B, therefore 'this.outer' should be implicitly derived to be of type 'test.B'. --
Jan 20 2015