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

          Issue ID: 20358
           Summary: External initialization of private struct fields
                    should be disallowed
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

s.d:

struct S {
    private int x;
}


test.d:

import s;

void main() {
    S s = {1}; // should fail to compile
    auto s2 = S(1); // should fail to compile
}

--

Reply via email to