[Issue 17298] New: Templates cause wrong deprecation warnings about derived class accessing private method
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 5 04:16:31 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17298
Issue ID: 17298
Summary: Templates cause wrong deprecation warnings about
derived class accessing private method
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: diagnostic
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: maximzms at gmail.com
Test code:
a.d:
----------
module a;
class Base
{
private void func() {}
}
void foo(T)() { new T().func(); } // line 8
struct Wrap(T)
{
void boo() { new T().func(); } // line 12
}
class Cover(T)
{
void boo() { new T().func(); } // line 17
}
----------
b.d:
----------
import a;
class Derived : Base {}
void main()
{
foo!Base(); // OK
foo!Derived(); // Deprecation warning
alias A = Wrap!Base; // OK
alias B = Wrap!Derived; // Deprecation warning
alias C = Cover!Base; // OK
alias D = Cover!Derived; // Deprecation warning
}
----------
dmd a b
----------
a.d(8): Deprecation: a.Base.func is not visible from class Derived
a.d(12): Deprecation: a.Base.func is not visible from class Derived
a.d(17): Deprecation: a.Base.func is not visible from class Derived
----------
--
More information about the Digitalmars-d-bugs
mailing list