http://d.puremagic.com/issues/show_bug.cgi?id=8408
--- Comment #11 from Kenji Hara <k.hara...@gmail.com> 2012-12-10 19:39:00 PST --- (In reply to comment #10) > (In reply to comment #8) > > (In reply to comment #6) > > I'm not sure that this should be allowed. > > ... > > Why not? It is known at the call site that anything foo1 will return is newly > allocated. Strong or weak purity is irrelevant. Your argument had be true. I had re-read issue 5081, and could be believed that between the purity level (strong, constant, weak) and the conversion possibility to immutable of returned value are irrelevant. From: http://d.puremagic.com/issues/show_bug.cgi?id=5081#c2 > Note actually that as long as you can verify the return value did not come > directly from the parameters, it's also possible to implicitly cast to > immutable. > > For example: > > pure T[] mydup(T)(const(T)[] param) {...} > > It's provable that the return value did not come from param (without a cast), > because you can't implicitly cast param to T[]. So you can cast the result to > immutable, >>>>even if param began as mutable<<<<. The last sentence describes the ideal behavior. Thanks a lot! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------