Bug 8717 – `private` and `protected` restrict member usage in same module

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-09-23T22:56:00Z
Last change time
2013-02-05T11:39:07Z
Keywords
pull, rejects-valid
Assigned to
andrej.mitrovich
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2012-09-23T22:56:32Z
--- struct C // struct, class, or union { private: // private or protected, for package see Issue 8716 enum e = 0; immutable static int si = 0; static int sf() { return 0; } immutable int i = 0; int f() const { return 0; } } static assert(C.e == 0); static assert(C.si == 0); static assert(C.sf() == 0); static assert(C.i == 0); static assert(C.init.e == 0); static assert(C.init.si == 0); // undefined identifier 'si' static assert(C.init.sf() == 0); // struct main.C member sf is not accessible static assert(C.init.i == 0); static assert(C.init.f() == 0); // struct main.C member f is not accessible --- There is no such errors if asserts are e.g. in a function.
Comment #1 by andrej.mitrovich — 2013-01-26T13:46:01Z
Comment #2 by github-bugzilla — 2013-01-29T23:40:27Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1a97d3662e905620780c5253bf25f7c3b2d21621 Fixes Issue 8717 - Private and Protected should be accessible from within same module. https://github.com/D-Programming-Language/dmd/commit/e7eff4deef0fb5ec9a89cee4716785832fc41fb9 Merge pull request #1557 from AndrejMitrovic/Fix8717 Issue 8717 - Private and Protected should be accessible from within the same module.