DIP-1000 and return
Nordlöw via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 2 07:28:57 PST 2017
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
{
return arr;
}
makes
@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]));
}
compile. Also
T[length] asStatic(T, size_t length)(scope T[length] arr)
@safe pure nothrow @nogc
{
return arr;
}
works. Is with or without `scope` preferred here?
Seems to be some problem with template qualifier inference.
Should I file a bug report?
More information about the Digitalmars-d-learn
mailing list