www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20642] New: protected member of superclass not accessible in


          Issue ID: 20642
           Summary: protected member of superclass not accessible in
                    subclass of inner class
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider the following code:

class A {
  class Subclass { }
  protected void foo() { }

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.

Mar 06 2020