Protected module members -- regression?
Mike Parker
aldacron at gmail.com
Mon Oct 29 10:37:33 UTC 2018
I've long had it in my mind to do a sort of "D for C++/Java/C#"
programmers sort of series on the blog. Inspired by the recent
conversation about private-to-the-module, I started one on that
topic. Then I encountered this:
```
module a;
protected int wrong;
```
```
module b;
import std.stdio;
import a;
int main() { writeln(wrong); }
```
I've always understood that protected module members are illegal.
The docs explicitly say so. Yet the declaration of `wrong`
compiles. Instead, trying to use it results in the deprecation
message about symbol visibility that was added a couple years
back when access modifiers were incorporated into symbol lookup.
I assume this is a regression and filed it as such [1], but I'm
curious if the compiler has ever actually complained about
protected module members.
[1] https://issues.dlang.org/show_bug.cgi?id=19340
More information about the Digitalmars-d
mailing list