D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20642 - protected member of superclass not accessible in subclass of inner class
Summary: protected member of superclass not accessible in subclass of inner class
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-06 09:38 UTC by FeepingCreature
Modified: 2020-03-06 09:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description FeepingCreature 2020-03-06 09:38:10 UTC
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 FeepingCreature 2020-03-06 09:58:37 UTC
Nevermind, is already fixed. My bad.