http://d.puremagic.com/issues/show_bug.cgi?id=10960
Summary: Copying a const value type should yield unqual Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: hst...@quickfur.ath.cx --- Comment #0 from hst...@quickfur.ath.cx 2013-09-03 16:09:25 PDT --- This is from a forum post. Code: ------ void main(){ auto A = [0, 1, 2]; const B = [10, -20, 30]; schwartzSort!(i => B[i])(A); // NG } ------ This fails because the return type of the lambda is deduced as const(int). This is silly since a copied const value type no longer needs to be const; it should be unqual. Explicitly naming the unqual type for the delegate fixes the problem: schwartzSort!(delegate int (i) => B[i])(A); // OK The user shouldn't be required to do this; returning a const value type by value should be stripped of its constness, since it is not the original value being returned, but a copy. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------