D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7902 - [TDPL] sychronized is supposed to be for classes, not functions
Summary: [TDPL] sychronized is supposed to be for classes, not functions
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: Andrej Mitrovic
URL:
Keywords: accepts-invalid, pull, safe, TDPL
Depends on:
Blocks:
 
Reported: 2012-04-13 21:20 UTC by Jonathan M Davis
Modified: 2024-12-13 17:59 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:20:33 UTC
Per TDPL (p. 414 - 419), synchronized is supposed to be on classes, not functions. It specifically talks about how D makes all of a class' function synchronized or none of them, as well as how that affects member variables. However, dmd seems to currently only apply synchronized to functions. This should be illegal:

class C
{
    synchronized int foo() {return 42;}

    bool bar() {return false;}
}

But it compiles. As opposed to what it should be

synchronized class C
{
    int foo() {return 42;}

    bool bar() {return false;}
}
Comment 1 Andrej Mitrovic 2014-01-06 12:47:19 UTC
https://github.com/D-Programming-Language/dmd/pull/3068
Comment 2 Andrei Alexandrescu 2014-03-15 21:14:39 UTC
Part of TLBB: http://forum.dlang.org/thread/lg383f$2mod$1@digitalmars.com
Comment 3 dlangBugzillaToGithub 2024-12-13 17:59:27 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18432

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB