Bug 8885 – Passing super class' private method as delegate allowed

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-24T07:41:00Z
Last change time
2017-07-05T20:50:36Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
gavin.norman
Blocks
2573

Comments

Comment #0 by gavin.norman — 2012-10-24T07:41:00Z
a.d module a; class A { private d ( ) { } } b.d module b; import a; class B : A { void x ( void delegate ( ) dg ) { dg(); } void f ( ) { x(&super.d); // Expected to not be allowed to access private method of A } }
Comment #1 by dlang-bugzilla — 2017-07-05T20:49:59Z
This was fixed by https://github.com/dlang/dmd/pull/5472. The compiler now produces: b.d(10): Deprecation: a.A.d is not visible from module b