www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 48] New: Acess with Fully-Qualified Names disregards protection attributes

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

           Summary: Acess with Fully-Qualified Names disregards protection
                    attributes
           Product: D
           Version: 0.149
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: daiphoenix lycos.com


Consider:
----- moduleFoo.d -----
  module moduleFoo;

  private void privateFunc() {}

Then in another module, accessing that entity with a fully qualified name will
disregard it's protection attribute:
----- ... -----
  void func() {
    privateFunc();           // Compile error, correct
    moduleFoo.privateFunc(); // Compile ok   , incorrect!
  }


-- 
Mar 14 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=48


daiphoenix lycos.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Acess with Fully-Qualified  |Access with Fully-Qualified
                   |Names disregards protection |Names disregards protection
                   |attributes                  |attributes





Actually, the erroneous behaviour of this bug is maybe happening too when using
*partially* qualified names. If so, this would effectively be the same bug as
"Protection Attributes not working for static member entities" such as when
doing:

  Foo.privateStaticMethod(); // Compiles ok, incorrect!

which also (incorrectly) compiles ok, altough the following (correctly) doesn't
compile:

  (new Foo).privateStaticMethod(); // privateStaticMethod is not accessible


-- 
Mar 14 2006