digitalmars.D.bugs - [Issue 9123] New: std.algorithm.reduce is not pure nothrow on const array
- d-bugmail puremagic.com (46/46) Feb 25 2014 https://d.puremagic.com/issues/show_bug.cgi?id=9123
https://d.puremagic.com/issues/show_bug.cgi?id=9123 Summary: std.algorithm.reduce is not pure nothrow on const array Product: D Version: D2 Platform: x86 OS/Version: Windows Status: RESOLVED Keywords: rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc CC: monarchdodra gmail.com monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |monarchdodra gmail.com Resolution| |WORKSFORME In this program spam1 and spam2 differ because 'items' is const in spam2: import std.algorithm: reduce; struct Foo {} immutable Foo zero; static Foo bar(Foo, Foo) pure nothrow { return zero; } void spam1(Foo[] items) pure nothrow { reduce!bar(zero, items); } void spam2(const Foo[] items) pure nothrow { reduce!bar(zero, items); } void main() {} Expected: both spam1 and spam2 allowed to be pure nothrow. But DMD 2.061alpha gives: test.d(11): Error: pure function 'spam2' cannot call impure function 'reduce' test.d(11): Error: reduce is not nothrow test.d(10): Error: function test.spam2 'spam2' is nothrow yet may throw Don't know when fixed, but the snippet works fine now in head. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 25 2014