Friends don't let friends use inout with scope and -dip1000

Nick Treleaven nick at geany.org
Tue Aug 21 16:15:57 UTC 2018


On Tuesday, 21 August 2018 at 13:42:31 UTC, Kagamin wrote:
> int[] escape(scope int[] r)
> {
>     return r; //error, can't return scoped argument
> }
...
> int[] escape(T)(scope int[] r)
> {
>     return r; //ok! `scope` silently promoted to `return`
> }
>
> You can't have strictly scoped parameter in a templated 
> function - it's silently promoted to return parameter. Is this 
> intended?

I filed a similar bug (it uses return type inference rather than 
a template). Walter closed it as invalid:
https://issues.dlang.org/show_bug.cgi?id=17362


More information about the Digitalmars-d mailing list