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(); }
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/lysfmrljbcvvfsprotag@forum.dlang.org