digitalmars.D.bugs - [Issue 21275] New: Overload resolution bypasses private access
- d-bugmail puremagic.com (50/50) Sep 25 2020 https://issues.dlang.org/show_bug.cgi?id=21275
https://issues.dlang.org/show_bug.cgi?id=21275 Issue ID: 21275 Summary: Overload resolution bypasses private access Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: 60rntogo gmail.com If I define the following module: --- module foo; struct Foo { import std : writeln; private int _x; private ref int x() return { writeln("ref int"); return _x; } int x() const { writeln("int"); return _x; } } --- and in another module: --- void main() { import std : writeln; import foo : Foo; auto f = Foo(); f.x = 3; writeln(f); } --- then the program prints --- ref int Foo(3) --- so I have gained access to private method x and member _x. --
Sep 25 2020