[Issue 8716] New: `package` restricts members usage in same module if there is no package name

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 23 22:16:50 PDT 2012


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

           Summary: `package` restricts members usage in same module if
                    there is no package name
           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:17:45 MSD ---
All asserts passes for e.g. `a.b` module name (except `C.init.sf()` which isn't
evaluatable at CT now).
---
module ab;

package int gf() { return 0; }
static assert(gf() == 0); // function ab.gf is not accessible from module ab

class C // struct, class, or union
{
package:
    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); // function ab.C.sf is not accessible from module
ab
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.T!().C member sf is not
accessible
static assert(C.init.i == 0);
---

-- 
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