digitalmars.D.bugs - [Issue 24387] New: Base class construction ignores private
- d-bugmail puremagic.com (35/35) Feb 11 https://issues.dlang.org/show_bug.cgi?id=24387
https://issues.dlang.org/show_bug.cgi?id=24387 Issue ID: 24387 Summary: Base class construction ignores private Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: snarwin+bugzilla gmail.com As of DMD 2.107.0, the following program compiles without errors: --- lib.d module lib; class Base { private this(int n) {} } --- app.d module app; import lib; class Derived : Base { this() { super(42); } } --- According to the language spec [1], private symbols can only be accessed from within the module that defines them. The section on base class construction [2] does not mention any exception to that rule. Therefore, if the spec is correct, the super(42) call should not compile. [1] https://dlang.org/spec/attribute.html#private [2] https://dlang.org/spec/class.html#base-construction --
Feb 11