[Issue 12625] implicit slicing of RValue static array should be illegal
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 7 07:35:43 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=12625
Nick Treleaven <ntrel-pub at mybtinternet.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ntrel-pub at mybtinternet.com
--- Comment #5 from Nick Treleaven <ntrel-pub at mybtinternet.com> ---
(In reply to monarchdodra from comment #2)
> I thought about it some more, and there *are* case where you can slice an
> rvalue static array, provided you've "used" it by the end of the expression.
...
> enum int[3] ints = [1, 2, 3];
> auto s = sum(ints);
...
> - Do we find some way to detect *only* the "rvalue static array to dynamic
> array assignment" case?
Your original example is always wrong:
int[1] foo();
int[] a = foo();
Slicing a returned static array should be disallowed by the compiler. Should we
rename this issue or file a new one for just this?
--
More information about the Digitalmars-d-bugs
mailing list