Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 12822 - Delegate .ptr assignment considered @safe
- Loading branch information
1 parent
26c2213
commit 51143be
Showing
3 changed files
with
37 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
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,16 @@ | ||
/* | ||
--- | ||
fail_compilation/test12822.d(11): Error: cannot modify delegate pointer in @safe code dg.ptr | ||
fail_compilation/test12822.d(12): Error: cannot modify delegate function pointer in @safe code dg.ptr | ||
--- | ||
*/ | ||
|
||
// https://issues.dlang.org/show_bug.cgi?id=12822 | ||
void test2(int delegate() dg) @safe | ||
{ | ||
static int i; | ||
dg.ptr = &i; | ||
dg.funcptr = &func; | ||
} | ||
|
||
int func(); |