[Issue 9011] New: One more strongly pure case
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 12 15:56:43 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9011
Summary: One more strongly pure case
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-11-12 15:56:39 PST ---
Maybe Hara has already a patch for this, but I don't remember its location.
I think it's good to refine the D purity to allow this code:
int[] foo1(int x) pure {
return null;
}
ubyte[] foo2(string s) pure {
return null;
}
void main() {
immutable a1 = foo1(10); // OK
immutable a2 = foo2("hello"); // currently error
}
Currently in DMD 2.061alpha it gives:
test.d(9): Error: cannot implicitly convert expression (foo2("hello")) of type
ubyte[] to immutable(ubyte[])
This enhancement means that foo2 becomes strongly pure.
--
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