-
-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 20956 - [DIP1000] @safe defeated by closure capturing ref p…
…arameter
- Loading branch information
1 parent
817610b
commit 1b1c31d
Showing
4 changed files
with
37 additions
and
5 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
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,19 @@ | ||
/* REQUIRED_ARGS: -preview=dip1000 | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/test20956.d(105): Error: function `test20956.forwardDg` cannot close over `ref` variable `c` | ||
--- | ||
*/ | ||
|
||
// https://issues.dlang.org/show_bug.cgi?id=20956 | ||
|
||
#line 100 | ||
|
||
@safe: | ||
|
||
alias DG = void delegate() @safe; | ||
|
||
DG forwardDg(ref int c) | ||
{ | ||
return () {assert(c == 42);}; | ||
} |