www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10170] New: __traits(compiles,b.x)) incorrectly allows to access private members

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

           Summary: __traits(compiles,b.x)) incorrectly allows to access
                    private members
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thelastmammoth gmail.com


--- Comment #0 from thelastmammoth gmail.com 2013-05-25 22:08:20 PDT ---
b.d:
struct B{
    private int x;
    private void foo1();
}

a.d:
import b;
void main(){
    auto b=B.init;
    static assert(__traits(compiles,b.x)); //why passes?
    static assert(__traits(compiles,b.foo1)); //why passes?
    static assert(!__traits(compiles,b.foo1())); //ok
    static assert(!__traits(compiles,b.x++)); //ok
}

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