Bug 20642 – protected member of superclass not accessible in subclass of inner class
Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-03-06T09:38:10Z
Last change time
2020-03-06T09:58:37Z
Assigned to
No Owner
Creator
FeepingCreature
Comments
Comment #0 by default_357-line — 2020-03-06T09:38:10Z
Consider the following code:
a.d:
class A {
class Subclass { }
protected void foo() { }
}
b.d:
class B : A {
class Subclass : A.Subclass {
void method() { foo; }
}
}
Despite the fact that B.Subclass exists in a subclass of A twice over, this errors with:
b.d(6): Error: class `a.A` member foo is not accessible
It works if I write 'this.outer.foo'.
It also works if I *don't* inherit B.Subclass from A.Subclass.
Comment #1 by default_357-line — 2020-03-06T09:58:37Z