← Back to index
|
Original Bugzilla link
Bug 18135 – [REG2.078] can't join RegexMatch anymore
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2017-12-28T00:20:36Z
Last change time
2017-12-29T22:18:31Z
Keywords
pull
Assigned to
No Owner
Creator
Seb
Comments
Comment #0
by greensunny12 — 2017-12-28T00:20:36Z
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 ```
Comment #1
by greensunny12 — 2017-12-28T00:36:49Z
This was introduced by
https://github.com/dlang/phobos/pull/4286
Comment #2
by greensunny12 — 2017-12-28T00:37:39Z
See also:
https://issues.dlang.org/show_bug.cgi?id=17066
Comment #3
by code — 2017-12-29T10:33:23Z
The referenced std.regex change is from 2016-12 and was reverted in the meantime. Digger pointed me to
https://github.com/dlang/phobos/pull/5722
instead.
Comment #4
by code — 2017-12-29T12:43:52Z
cat > bug.d << CODE import std.regex : RegexMatch; struct MapResult(Range) { Range input; } void bug() { MapResult!(RegexMatch!string) res; res = MapResult!(RegexMatch!string)(); } CODE dmd -c bug.d ---- bug.d(11): Error: cannot modify struct res MapResult!(RegexMatch!string) with immutable members ----
Comment #5
by code — 2017-12-29T12:55:10Z
https://github.com/dlang/phobos/pull/5972
Comment #6
by github-bugzilla — 2017-12-29T13:33:29Z
Commits pushed to stable at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/b221120735b04095a6d4c7702eb9cc6e37aba170
fix Issue 18135 - can't join RegexMatch anymore - fix copying of structs with RegexMatch fields by making const interface reference rebindable
https://github.com/dlang/phobos/commit/8c19c30d239f034c14ec21d216ccf26ee136db61
Merge pull request #5972 from MartinNowak/fix18135 fix Issue 18135 - can't join RegexMatch anymore merged-on-behalf-of: Sebastian Wilzbach <
[email protected]
>
Comment #7
by github-bugzilla — 2017-12-29T22:18:31Z
Commits pushed to master at
https://github.com/dlang/phobos
https://github.com/dlang/phobos/commit/b221120735b04095a6d4c7702eb9cc6e37aba170
fix Issue 18135 - can't join RegexMatch anymore
https://github.com/dlang/phobos/commit/8c19c30d239f034c14ec21d216ccf26ee136db61
Merge pull request #5972 from MartinNowak/fix18135