[Issue 8717] New: `private` and `protected` restrict member usage in same module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 23 22:55:37 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8717

           Summary: `private` and `protected` restrict member usage in
                    same module
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-09-24 09:56:32 MSD ---
---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list