Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
October 12, 2013 [Issue 11234] New: Method of another module is callable, even if they is private. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=11234 Summary: Method of another module is callable, even if they is private. Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: rswhite4@googlemail.com --- Comment #0 from rswhite4@googlemail.com 2013-10-12 12:20:03 PDT --- A.d: ---- import B; class Foo { public: void call(Bar b) { void delegate(int) dg = &b.test; dg(42); } } void main() { Bar b = new Bar(); Foo f = new Foo(); f.call(b); } ---- B.d: ---- import std.stdio; class Bar { private: void test(int id) { writeln("Bar called with ", id); } } ---- Output: Bar called with 42 But should be rejected. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 12, 2013 [Issue 11234] Address of private method from another module can be taken | ||||
---|---|---|---|---|
| ||||
Posted in reply to rswhite4@googlemail.com | http://d.puremagic.com/issues/show_bug.cgi?id=11234 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid CC| |andrej.mitrovich@gmail.com Summary|Method of another module is |Address of private method |callable, even if they is |from another module can be |private. |taken --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-10-12 12:23:34 PDT --- Reduced a little bit: ----- module a; import b; void main() { auto s = S(); auto f = &s.f; // no error f(); // no error auto sf = &S.sf; // error } ----- ----- module b; struct S { private void f() { } private static void sf() { } } ----- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 12, 2013 [Issue 11234] Address of private method from another module can be taken | ||||
---|---|---|---|---|
| ||||
Posted in reply to rswhite4@googlemail.com | http://d.puremagic.com/issues/show_bug.cgi?id=11234 --- Comment #2 from rswhite4@googlemail.com 2013-10-12 12:29:08 PDT --- I'm unsure, but maybe we should also classify this as major because it breaks the protection? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation