DIP-1000 and return

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 2 06:38:53 PST 2017


On Sunday, 1 January 2017 at 18:00:54 UTC, Stefan Koch wrote:

> Try:
>  auto asStatic(T, size_t length)(scope T[length] arr)
>  {
>      return arr;
>  }

I've tried as many combinations of `return` and `scope` as I can 
think of such as

     T[length] asStatic(T, size_t length)(return scope T[length] 
arr)
     {
         return arr;
     }

but all complain about the same thing

Error: parameter arr is 'return' but function does not return any 
indirections

It seems like compiler incorrectly infers that `arr` must be 
`return` despite it doesn't have any indirections (because it's a 
static array).

Walter?


More information about the Digitalmars-d-learn mailing list