Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 7903 - Disallow public members in a synchronized class
- Loading branch information
1 parent
d2c607f
commit 1ac5c08
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail7903.d(21): Error: variable fail7903.F1.x Field members of a synchronized class cannot be public | ||
fail_compilation/fail7903.d(22): Error: variable fail7903.F1.y Field members of a synchronized class cannot be export | ||
fail_compilation/fail7903.d(27): Error: variable fail7903.F2.x Field members of a synchronized class cannot be public | ||
--- | ||
*/ | ||
synchronized class K1 | ||
{ | ||
public struct S { } | ||
} | ||
|
||
synchronized class K2 | ||
{ | ||
struct S { } | ||
} | ||
|
||
synchronized class F1 | ||
{ | ||
public int x; | ||
export int y; | ||
} | ||
|
||
synchronized class F2 | ||
{ | ||
int x; | ||
} |