Bug 14275 – Qualified package protection for aggregate member doesn't work
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-11T01:05:00Z
Last change time
2015-06-17T21:01:59Z
Keywords
pull
Assigned to
nobody
Creator
public
Comments
Comment #0 by public — 2015-03-11T01:05:14Z
From http://forum.dlang.org/post/[email protected]
----
module A.B.Foo;
import core.stdc.stdio : printf;
struct Foo {
package(A) void foo() {
printf("Hallo\n");
}
}
package(A) void bar() {
printf("Hallo\n");
}
----
and
----
module A.C.Bar;
import A.B.Foo;
void main() {
Foo f;
f.foo();
bar();
}
----
The call of bar() works, but f.foo() triggers the error:
Error: struct A.B.Foo.Foo member foo is not accessible
Comment #1 by public — 2015-03-11T01:15:16Z
Bug is in usage of this access.c function:
265 /****************************************
266 * Determine if scope sc has package level access to s.
267 */
268 bool hasPackageAccess(Scope *sc, Dsymbol *s)
It is getting called for aggregate symbol too, even if it is public itself, assuming package protection.
PR incoming.