[Issue 8408] Purity calculation should be improved
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 10 18:37:45 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8408
timon.gehr at gmx.ch changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |timon.gehr at gmx.ch
--- Comment #10 from timon.gehr at gmx.ch 2012-12-10 18:37:41 PST ---
(In reply to comment #8)
> (In reply to comment #6)
> > Is it correct that x1 refused and x2 accepted?
> >
> >
> > char[] foo1(int[] arr) pure {
> > return new char[10];
> > }
> > immutable(char)[] foo2(int[] arr) pure {
> > return new char[10];
> > }
> > void main(string[] args) {
> > immutable x1 = foo1([1, 2]); // Error: cannot implicitly convert
> > immutable x2 = foo2([1, 2]); // OK
> > }
>
> 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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list