I have a problem where a base class has some member with package protection, and a class that derives from the base seems to hijack the base classes visibility constraints.
In the example in f(), i can access the base class directly, but I can't access it via the derived class, even though it should (?) be accessible...
If i 'cast(C)D", then I can call f(), as expected. I shouldn't have to perform this case to access package visible base members.
-----------------------
module x.a;
import x.y; // import class C
import x.y.z; // import class D : C
void f()
{
C c;
c.f(); // no problem, C is declared in the same package
D d;
d.f(); // error! D doesn't define f(), C does, and we have access to C as demonstrated above
}
-----------------------
module x.y;
class C
{
package:
void f()
{
}
}
-----------------------
module x.y.z;
class D : C
{
}
Comment #1 by dlang-bot — 2021-06-30T02:58:31Z
@thewilsonator created dlang/dmd pull request #12786 "Add test case for issue 13197" mentioning this issue:
- Add test case for issue 13197
https://github.com/dlang/dmd/pull/12786
Comment #2 by robert.schadek — 2024-12-13T18:22:46Z