Bug 7316 – the result of a strongly pure function should implicitly convert to and from shared

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-18T17:13:54Z
Last change time
2018-11-12T10:21:16Z
Assigned to
No Owner
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2012-01-18T17:13:54Z
The following code should compile: int[] foo()pure{return new shared(int)[1];} shared(int)[] bar()pure{return new int[2];} void main(){ shared a = foo(); int[] b = bar(); }
Comment #1 by timon.gehr — 2018-11-12T10:21:16Z
This enhancement was based on the assumption that conversions to immutable of strongly pure function results are safe (as DMD currently allows it in @safe code), but as John Colvin points out [1], this is not actually the case. The same counterexample works here, therefore I am closing this as invalid. [1] https://forum.dlang.org/post/[email protected]