[Issue 12625] implicit slicing of RValue static array should be illegal
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 14 07:27:42 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=12625
--- Comment #8 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> ---
(In reply to Steven Schveighoffer from comment #7)
> I think we can say safely that slicing an rvalue return cannot lead to
> anything good.
>
> As for the example of why it should be allowed, I'm not convinced.
tempCString is another example of an rvalue reference. Works good so far.
> example requires blind faith that the receiver of the slice never does
> anything bad with it, and assumes the compiler doesn't cleverly reclaim the
> memory for the rvalue seeing as it wasn't used anywhere.
If the temporary isn't used, it should be reclaimed.
--
More information about the Digitalmars-d-bugs
mailing list