From 0c4ebc2ce702ca6e06379d80e78efc9ccb050ced Mon Sep 17 00:00:00 2001 From: "H. S. Teoh" Date: Tue, 9 Oct 2012 21:58:19 -0700 Subject: [PATCH 1/2] Fix issue 8792. std.algorithm.joiner(ror).Result.save fails to copy over _valid_current, resulting in a defective copy returned by .save. --- std/algorithm.d | 1 + 1 file changed, 1 insertion(+) diff --git a/std/algorithm.d b/std/algorithm.d index ae8a657de..1232c3999 100644 --- a/std/algorithm.d +++ b/std/algorithm.d @@ -2718,6 +2718,7 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR)) Result copy; copy._items = _items.save; copy._current = _current.save; + copy._valid_current = _valid_current; return copy; } } From d215dabbe2c70e737556933e6820ae5b0bf9ab93 Mon Sep 17 00:00:00 2001 From: "H. S. Teoh" Date: Tue, 9 Oct 2012 22:03:48 -0700 Subject: [PATCH 2/2] Add unittest for issue 8792. --- std/algorithm.d | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/std/algorithm.d b/std/algorithm.d index 1232c3999..cd03fa72f 100644 --- a/std/algorithm.d +++ b/std/algorithm.d @@ -2749,6 +2749,12 @@ unittest // bugzilla 8240 assert(equal(joiner([inputRangeObject("")]), "")); + + // issue 8792 + auto b = [[1], [2], [3]]; + auto jb = joiner(b); + auto js = jb.save; + assert(equal(jb, js)); } // uniq