[Issue 9230] Incorrect implicit immutable conversion occurs in pure function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 27 20:19:52 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9230
--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-12-27 20:19:47 PST ---
(In reply to comment #0)
> The implicit immutable conversion on return statement is valid only if the
> strong purity function has *no parameters*.
...No, this is incorrect. I found a disproof.
Correct requirement is:
"If all parameters have no mutable indirections, implicit immutable conversion
on return statement is allowed."
For example:
immutable(int[]) foo(int n) { return new int[](n); }
immutable(int[]) bar(immutable int[] arr) { return new int[](arr.length); }
void main() {
immutable a = foo(10);
immutable b = bar([1,2]);
}
Both foo and bar should be allowed.
--
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