www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9546] New: getProtection trait does not work with mixin or getMember

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9546

           Summary: getProtection trait does not work with mixin or
                    getMember
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



20:37:50 PST ---
/imorts/a.d:
---------------------------
module imports.a;

class S
{
    private int privA;
    protected int protA;
    package int packA;
}
---------------------------


/test.d:
---------------------------
import imports.a;

void main()
{
    S s;
    static assert(__traits(getProtection, s.privA) == "private");
    static assert(__traits(getProtection, s.protA) == "protected");
    static assert(__traits(getProtection, s.packA) == "package");

    /** NG - symbols not accessible */
    static assert(__traits(getProtection, mixin("s.privA")) == "private");
    static assert(__traits(getProtection, mixin("s.protA")) == "protected");
    static assert(__traits(getProtection, mixin("s.packA")) == "package");

    /** NG - symbols not accessible */
    static assert(__traits(getProtection, 
                  __traits(getMember, s, "privA")) == "private");
    static assert(__traits(getProtection, 
                  __traits(getMember, s, "protA")) == "protected");
    static assert(__traits(getProtection, 
                  __traits(getMember, s, "packA")) == "package");
}
---------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 19 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9546




21:12:30 PST ---
An almost working workaround is to use T.init.tupleof[index] to get a member
without triggering access protection errors, however this will not work with
methods since they're not part of .tupleof() (only fields are).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9546


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/2361

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9546




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ad28224b3c5240f466c8e3b384a55b07742a4a90
fix Issue 9546 - getProtection trait does not work with mixin or getMember

Stop access check during `__traits(getProtection)` evaluated.

https://github.com/D-Programming-Language/dmd/commit/2ead3f00168ce9b99e1c845e631b3603bcccb905


Issue 9546 - getProtection trait does not work with mixin or getMember

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 21 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9546


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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