[Issue 15897] New: private base functions not callable from base class module without type change
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Apr 8 06:04:21 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15897
Issue ID: 15897
Summary: private base functions not callable from base class
module without type change
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: schveiguy at yahoo.com
Example (from
https://forum.dlang.org/post/jebqwhmasrtzrfhmlzeq@forum.dlang.org)
module a;
import b;
class Animal
{
private void create() {}
}
void foo(Cat cat)
{
cat.create(); // >> no property create for type 'b.cat'
}
void main() {}
--------------
module b;
import a;
class Cat: Animal {}
Compiles with 2.070
Fails in 2.071.0:
Error: no property 'create' for type 'b.Cat'
If I do this:
void foo(Cat cat)
{
Animal a = cat;
a.create();
}
It now compiles. The user shouldn't have to jump through this hoop, the
compiler is aware of the access of create via the base class.
If you move Cat into the same module, it also compiles.
--
More information about the Digitalmars-d-bugs
mailing list