D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8885 - Passing super class' private method as delegate allowed
Summary: Passing super class' private method as delegate allowed
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 2573
  Show dependency treegraph
 
Reported: 2012-10-24 07:41 UTC by gavin.norman
Modified: 2017-07-05 20:50 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description gavin.norman 2012-10-24 07:41:00 UTC
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 Vladimir Panteleev 2017-07-05 20:49:59 UTC
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