Bug 48 – Access with Fully-Qualified Names disregards protection attributes
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-03-14T11:17:00Z
Last change time
2014-02-15T02:10:08Z
Keywords
accepts-invalid
Assigned to
bugzilla
Creator
bruno.do.medeiros+deebugz
Comments
Comment #0 by bruno.do.medeiros+deebugz — 2006-03-14T11:17:47Z
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!
}
Comment #1 by bruno.do.medeiros+deebugz — 2006-03-14T14:56:52Z
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
Comment #2 by bruno.do.medeiros+deebugz — 2006-06-19T06:43:12Z
*** Bug 206 has been marked as a duplicate of this bug. ***
Comment #3 by bruno.do.medeiros+deebugz — 2006-07-19T18:21:20Z
Fixed DMD 0.163.
But note related bug 257.
Comment #4 by bruno.do.medeiros+deebugz — 2006-07-19T18:22:01Z