www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DIP-1000 scope analysis doesn't kick in for small-size-optimized

reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
I'm now satisfied with my SSOString at

https://github.com/nordlow/phobos-next/blob/master/src/sso_string.d

However, I'm having problems within making lifetime analysis via 
scope kick in. For instance, the function `f` at

https://github.com/nordlow/phobos-next/blob/master/src/sso_string.d#L219

shouldn't compile, but it does.

Have I missed something or is this yet another corner-case that 
requires a new bugzilla issue?

Walter?

Andrei?
Apr 19 2018
next sibling parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 19 April 2018 at 17:36:19 UTC, Per Nordlöw wrote:
 However, I'm having problems within making lifetime analysis 
 via scope kick in. For instance, the function `f` at

 https://github.com/nordlow/phobos-next/blob/master/src/sso_string.d#L219
Note that qualifying `opSlice` as `inout` doesn't help.
Apr 19 2018
prev sibling parent Radu <void null.pt> writes:
On Thursday, 19 April 2018 at 17:36:19 UTC, Per Nordlöw wrote:
 I'm now satisfied with my SSOString at

 https://github.com/nordlow/phobos-next/blob/master/src/sso_string.d

 However, I'm having problems within making lifetime analysis 
 via scope kick in. For instance, the function `f` at

 https://github.com/nordlow/phobos-next/blob/master/src/sso_string.d#L219

 shouldn't compile, but it does.

 Have I missed something or is this yet another corner-case that 
 requires a new bugzilla issue?

 Walter?

 Andrei?
Removing `scope` from the function prototype will work. See https://run.dlang.io/is/BIYSY4 I think it is a bug, but might be wrong as dip1000 spec is not up2date.
Apr 19 2018