Comment #0 by sahmi.soulaimane — 2019-11-17T01:14:21Z
Test case:
```
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(){}
}
```
Assertion fails. `passthrough` should return `i` without making a copy of it.
Comment #1 by dlang-bot — 2019-11-17T17:57:53Z
@SSoulaimane updated dlang/dmd pull request #10577 "Fix issue 20401 - The glue shouldn't copy side effects by value where the lvalue is wanted" fixing this issue:
- Fix issue 20401 - The glue shouldn't copy side effects by value where the lvalue is wanted
By ref semantics should be preserved when extracting side effects.
https://github.com/dlang/dmd/pull/10577
Comment #2 by dlang-bot — 2019-11-23T00:46:17Z
dlang/dmd pull request #10577 "Fix issue 20401 - The glue shouldn't copy side effects by value where the lvalue is wanted" was merged into master:
- 4cfff1cfb084ad54dc27c3dd32c203a89ecde230 by سليمان السهمي (Suleyman Sahmi):
Fix issue 20401 - The glue shouldn't copy side effects by value where the lvalue is wanted
By ref semantics should be preserved when extracting side effects.
https://github.com/dlang/dmd/pull/10577