Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 15193 - DIP25 (implementation): Lifetimes of temporaries tr…
…acked incorrectly
- Loading branch information
1 parent
feb06a7
commit f2c50d0
Showing
2 changed files
with
33 additions
and
8 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,19 @@ | ||
/* REQUIRED_ARGS: -dip25 | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/test15193.d(17): Error: escaping reference to local variable s | ||
--- | ||
*/ | ||
|
||
|
||
// https://issues.dlang.org/show_bug.cgi?id=15193 | ||
|
||
ref int foo()@safe{ | ||
struct S{ | ||
int x; | ||
ref int bar() { return x; } | ||
} | ||
S s; | ||
return s.bar(); | ||
} | ||
|