Safe cast away from immutable

Iakh via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 8 13:14:11 PST 2016


On Monday, 8 February 2016 at 20:43:23 UTC, Jonathan M Davis 
wrote:
>
>
>
> in a bug report should be sufficient to show the bug, even 
> without the rest of what you're doing.
>
> In general, it should be impossible for member functions to be 
> considered strongly pure unless they're marked as immutable, 
> though the compiler could certainly be improved to determine 
> that no escaping of the return value or anything referencing it 
> occurs within the function and that thus it can get away with 
> treating the return value as if it's the only reference to that 
> data, but that would likely be farther into the realm of code 
> flow analysis than the compiler typically does.

It does. A bit. If S.arr is int[] the program fails to compile.
Is all prams being const(but not immutable) not enough for
function to be Pure?

>
> Regardless, your example definitely shows a bug. Please report 
> it. Thanks.

Done
https://issues.dlang.org/show_bug.cgi?id=15660



More information about the Digitalmars-d mailing list