Re: DIP-1000 and return

2017-03-08 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Monday, 2 January 2017 at 15:28:57 UTC, Nordlöw wrote: Should I file a bug report? Yes please

Re: DIP-1000 and return

2017-01-02 Thread Nordlöw via Digitalmars-d-learn
On Monday, 2 January 2017 at 14:38:53 UTC, Nordlöw wrote: I've tried as many combinations of `return` and `scope` as I can think of such as Update: Qualifying `asStatic` with `@safe pure nothrow @nogc` as T[length] asStatic(T, size_t length)(T[length] arr) @safe pure nothrow @nogc { r

Re: DIP-1000 and return

2017-01-02 Thread Nordlöw via Digitalmars-d-learn
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]

Re: DIP-1000 and return

2017-01-01 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 1 January 2017 at 17:41:46 UTC, Nordlöw wrote: now fails on Git master (after DIP-1000 has been merged) as When compiled with `-transition=safe`, that is.

Re: DIP-1000 and return

2017-01-01 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 1 January 2017 at 17:41:46 UTC, Nordlöw wrote: The code auto asStatic(T, size_t length)(T[length] arr) { return arr; } @safe pure nothrow @nogc unittest { auto x = [1, 2, 3].asStatic; static assert(is(typeof(x) == int[x.length])); static assert(is(typeof([1, 2, 3].as

Re: DIP-1000 and return

2017-01-01 Thread Nordlöw via Digitalmars-d-learn
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; } Fails as array_ex.d(72,10): Error: parameter arr is 'return' but function does not return any indirections array_ex.d(80,27): Error: template instanc

DIP-1000 and return

2017-01-01 Thread Nordlöw via Digitalmars-d-learn
The code auto asStatic(T, size_t length)(T[length] arr) { return arr; } @safe pure nothrow @nogc unittest { auto x = [1, 2, 3].asStatic; static assert(is(typeof(x) == int[x.length])); static assert(is(typeof([1, 2, 3].asStatic) == int[x.length])); } now fails on Git master (