On Monday, 11 March 2019 at 22:29:05 UTC, aliak wrote:
[...]
Here's a much reduces test case:
struct W(T) {}
struct S {
int* data;
}
template match1(alias handler) {
auto ref match1(T)(inout auto ref W!T w) {
return handler();
}
}
template match2(alias handler) {
aut
On Monday, 11 March 2019 at 22:29:05 UTC, aliak wrote:
Hi,
I have an error that says "Error: returning `match1(opt)`
escapes a reference to parameter `opt`, perhaps annotate with
`return`".
[...]
Ok, I've found out something else. It only happens when you're
returning a type that has an i
Hi,
I have an error that says "Error: returning `match1(opt)` escapes
a reference to parameter `opt`, perhaps annotate with `return`".
The code is here: https://run.dlang.io/is/ESZDW4 (It's copied at
the end of this post as well)
1) If you remove the inout from line 11. It works.
2) If you