-
-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10577 from SSoulaimane/irlvalue
Fix issue 20401 - The glue shouldn't copy side effects by value where the lvalue is wanted merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 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,20 @@ | ||
// https://issues.dlang.org/show_bug.cgi?id=20401 | ||
|
||
void main() | ||
{ | ||
int i; | ||
assert(&passthrough(i) == &i); | ||
} | ||
|
||
ref int passthrough(return ref int i) | ||
{ | ||
return get().flag ? i : i; | ||
} | ||
|
||
S get() { return S(); } | ||
|
||
struct S | ||
{ | ||
bool flag; | ||
~this(){} | ||
} |