www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19340] New: Protected module members are supposed to be illegal


          Issue ID: 19340
           Summary: Protected module members are supposed to be illegal
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: aldacron gmail.com

I've marked this as a regression because the docs [1] say:

"protected module members are illegal."

However, the compiler not complain about protected module members:

module a;

// This compiles
protected int wrong;

module b;
import std.stdio;
import a;

int main() { writeln(wrong); }

Instead, it gives the deprecation message about visibility:

"Deprecation: a.wrong is not visible from module b"

With -d, it compiles and runs.

[1] https://dlang.org/spec/attribute.html#visibility_attributes

Oct 29 2018