Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 15192 - DIP25: Nested ref returns are type checked unsoundly
- Loading branch information
1 parent
1116591
commit ad419f2
Showing
3 changed files
with
84 additions
and
37 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,23 @@ | ||
/* | ||
REQUIRED_ARGS: -dip25 | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/test15192.d(14): Error: escaping reference to outer local ref variable x | ||
--- | ||
*/ | ||
|
||
|
||
// https://issues.dlang.org/show_bug.cgi?id=15192 | ||
|
||
ref int fun(ref int x) @safe | ||
{ | ||
ref int bar(){ return x; } | ||
return bar(); | ||
} | ||
|
||
ref int fun2(return ref int x) @safe | ||
{ | ||
ref int bar(){ return x; } | ||
return bar(); | ||
} | ||
|
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