[Issue 17066] [REG2.073a] std.regex captures got immutable

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 26 04:33:20 PST 2017


https://issues.dlang.org/show_bug.cgi?id=17066

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |code at dawg.eu
         Resolution|FIXED                       |---

--- Comment #5 from Martin Nowak <code at dawg.eu> ---
cat > bug.d << CODE
import std.algorithm : joiner, map;

auto matchIssueRefs(string message)
{
    import std.regex;
    return message.matchAll(`a|b`).joiner;
}

void getIssueRefs(string[] messages)
{
    messages.map!(m => m.matchIssueRefs).joiner;
}
CODE
dmd -c -o- bug
----
/usr/include/dmd/phobos/std/algorithm/iteration.d-mixin-2442(2456): Error:
cannot modify struct this._current Result with immutable members
bug.d(11): Error: template instance
std.algorithm.iteration.joiner!(MapResult!(__lambda2, string[])) error
instantiating
----

Thanks for the fix, but it only seems to solves half of the problem, still
getting this error with a nested `joiner`.

--


More information about the Digitalmars-d-bugs mailing list