https://issues.dlang.org/show_bug.cgi?id=16531

          Issue ID: 16531
           Summary: Protected members not accessible in delegate bodies
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: johnch_a...@hotmail.com

DMD reports an error when trying to call the protected method of a superclass
from inside the body of a delegate. Code to repro:

void layoutTransaction(void delegate() action) {
  action();
}

class Control {
  protected void onTextChanged() {}
}

class Label : Control {
  protected override void onTextChanged() {
    layoutTransaction({
      super.onTextChanged();
    });
  }
}

Output: class Control member onTextChanged is not accessible.

I think protected methods should be allowed to be called in this way. Note that
private methods do seem to be accessible.

--

Reply via email to