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.
Comment #2 by public — 2015-03-11T01:44:04Z
Comment #3 by k.hara.pg — 2015-03-11T08:04:43Z
*** Issue 14271 has been marked as a duplicate of this issue. ***
Comment #4 by github-bugzilla — 2015-03-11T11:07:29Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f3429ca61d5966a3b6e3ac2dcbff4d596d27f292 Fix issue 14275 "Qualified package protection for aggregate member doesn't work" https://issues.dlang.org/show_bug.cgi?id=14275 When checking protection of aggregate member symbol, DMD previosuly checked protection of aggregate itself, assuming it has same protection. Those need to be done separately. https://github.com/D-Programming-Language/dmd/commit/a061c863b4ed516cff86b063174ba125de31fd6b Merge pull request #4476 from mihails-strasuns-sociomantic/fix-14275-aggregate-member-protection Fix issue 14275 : qualified package protection for aggregate member doesn't work
Comment #5 by github-bugzilla — 2015-03-12T11:18:53Z
Commit pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a44e09d3d16b7c23e540bce8be5dffde2dfa17fa Merge pull request #4476 from mihails-strasuns-sociomantic/fix-14275-aggregate-member-protection Fix issue 14275 : qualified package protection for aggregate member doesn't work
Comment #6 by github-bugzilla — 2015-04-11T12:24:57Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a44e09d3d16b7c23e540bce8be5dffde2dfa17fa Merge pull request #4476 from mihails-strasuns-sociomantic/fix-14275-aggregate-member-protection
Comment #7 by github-bugzilla — 2015-06-17T21:01:59Z