D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7903 - [TDPL] public member variables are supposed to be illegal in synchronized classes
Summary: [TDPL] public member variables are supposed to be illegal in synchronized cla...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: Andrej Mitrovic
URL: https://github.com/D-Programming-Lang...
Keywords: accepts-invalid, pull, TDPL
Depends on:
Blocks:
 
Reported: 2012-04-13 21:22 UTC by Jonathan M Davis
Modified: 2016-01-03 14:02 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2012-04-13 21:22:30 UTC
Per TDPL (p. 419), it's illegal to have public member variables in synchronized classes, but this compiles:

synchronized class C
{
    int i;
}
Comment 1 Andrej Mitrovic 2014-01-06 11:53:56 UTC
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
Comment 2 Andrej Mitrovic 2014-01-06 12:23:26 UTC
https://github.com/D-Programming-Language/dmd/pull/3067
Comment 3 Andrej Mitrovic 2014-01-06 12:24:54 UTC
(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?
Comment 4 Walter Bright 2014-01-06 20:48:53 UTC
The spec is the spec, not TDPL, so these should be accompanied by a pull request on the spec.
Comment 5 Andrej Mitrovic 2014-01-07 00:54:54 UTC
(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).
Comment 6 github-bugzilla 2015-10-19 16:41:14 UTC
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
Comment 7 github-bugzilla 2016-01-03 14:02:00 UTC
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