[Issue 18135] New: [REG2.078] can't join RegexMatch anymore

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 28 00:20:36 UTC 2017


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

          Issue ID: 18135
           Summary: [REG2.078] can't join RegexMatch anymore
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: greensunny12 at gmail.com

This used to compile, it doesn't anymore with 2.078.0:

```
import std.algorithm : joiner, map;

auto matchIssueRefs(string message)
{
    import std.regex;

    static auto matchToRefs(M)(M m)
    {
        enum splitRE = regex(`foo`);
        return m.captures[0].splitter(splitRE);
    }

    enum issueRE = ctRegex!`foo`;
    return message.matchAll(issueRE).map!matchToRefs;
}

auto getIssueRefs(string[] commits)
{
    return commits
        .map!matchIssueRefs
        .joiner;
}
```

with:

```
/home/seb/dlang/phobos/std/algorithm/iteration.d(2504): Error: cannot modify
struct this._current MapResult!(matchToRefs, RegexMatch!string) with immutable
members
test.d(21): Error: template instance
std.algorithm.iteration.joiner!(MapResult!(matchIssueRefs, string[])) error
instantiating
```

--


More information about the Digitalmars-d-bugs mailing list