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:

           Summary: Acess with Fully-Qualified Names disregards protection
           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

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

daiphoenix lycos.com changed:

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

------- Comment #1 from daiphoenix lycos.com  2006-03-14 14:56 -------
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

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

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

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

Mar 14 2006