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