[Issue 20358] New: External initialization of private struct fields should be disallowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 6 07:05:22 UTC 2019


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: nobody at puremagic.com
          Reporter: maxsamukha at gmail.com

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
}

--


More information about the Digitalmars-d-bugs mailing list