www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18979] New: Template constructor bypasses private

https://issues.dlang.org/show_bug.cgi?id=18979

          Issue ID: 18979
           Summary: Template constructor bypasses private
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

The following compiles but shouldn't:

foo.d:
struct Foo {
    private this(A)(A arg) { }
}

bar.d:
import foo;
void func() {
    auto f = Foo(42);
}

--
Jun 13 2018