https://issues.dlang.org/show_bug.cgi?id=2775
Simon Na. <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #6 from Simon Na. <[email protected]> --- In DMD 2.070, the bug still manifests for private template methods. It's fixed for static class functions, and for module-scope functions. Here's example code that errors out correctly: // foo.d import std.conv; private string func(T)(T t) { return t.to!string; } // main.d import std.stdio; import foo; void main() { writeln("hello world " ~ func(4)); } Error message, as expected: main.d(6): Error: module main template foo.func(T)(T t) is private main.d(6): Error: function foo.func!int.func is not accessible from module main However, if I make a class in foo.d and put the template inside, the code compiles, links, and calls the private function: // foo.d import std.conv; class A { private string func(T)(T t) { return t.to!string; } } // main.d import std.stdio; import foo; void main() { A a = new A(); writeln("hello world " ~ a.func(4)); } Expected instead: A privacy violation error, as in my first example code. --
