https://issues.dlang.org/show_bug.cgi?id=19966

--- Comment #6 from Jacob Carlborg <d...@me.com> ---
(In reply to Walter Bright from comment #3)
> > 1. `Foo` as a template and as a non-template struct behaves differently
> 
> What's happening is that when `Foo` is a template, then inference happens
> with `foo()`, which infers that `this.bar` is being returned, not `this`.
> You can verify this by removing the function body for `foo()` so inference
> cannot happen, and then the error appears, because without inference the
> `return` applies to `this`, not `this.bar`.
> 
> Not a bug.

But is it possible to get what I want somehow? To make sure no internal state
of "f" outlives "f" itself.

--

Reply via email to