Per TDPL (p. 419), it's illegal to have public member variables in synchronized classes, but this compiles: synchronized class C { int i; }
Also in TDPL: - Access to protected members is restricted to methods of the class and its descendants (ed: not sure what's different about this one?) - Access to private members is restricted to methods of the class
https://github.com/D-Programming-Language/dmd/pull/3067
(In reply to comment #2) > https://github.com/D-Programming-Language/dmd/pull/3067 (In reply to comment #1) > Also in TDPL: > > - Access to protected members is restricted to methods of the class and its > descendants (ed: not sure what's different about this one?) > - Access to private members is restricted to methods of the class Not implemented in the above pull. I can work on these later, although I still need elaboration on what the first item means. Perhaps Andrei meant that protected members will not be accessible from within the same module just like the private members?
The spec is the spec, not TDPL, so these should be accompanied by a pull request on the spec.
(In reply to comment #4) > The spec is the spec, not TDPL, so these should be accompanied by a pull > request on the spec. As soon as we have a passing and merged pull I'll make an accompanying pull. Otherwise there's not much point in making two pulls when one of the pulls might take months to merge (forcing the dev to rebase two pulls instead of just one).
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1ac5c08bb374496bfbc175d495c1307a98008238 Fix Issue 7903 - Disallow public members in a synchronized class https://github.com/D-Programming-Language/dmd/commit/72b4e80be2b5bb1f5c7c9bfb8fb7b9067161d477 Merge pull request #5188 from AndrejMitrovic/fix-7903 Issue 7903 - Disallow public members in a synchronized class
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1ac5c08bb374496bfbc175d495c1307a98008238 Fix Issue 7903 - Disallow public members in a synchronized class https://github.com/D-Programming-Language/dmd/commit/72b4e80be2b5bb1f5c7c9bfb8fb7b9067161d477 Merge pull request #5188 from AndrejMitrovic/fix-7903