www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17066] New: std.regex captures got immutable


          Issue ID: 17066
           Summary: std.regex captures got immutable
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greeenify gmail.com

The following reduced code used to work with 2.072.2:

    import std.stdio : writeln;
    import std.regex : ctRegex, matchAll, regex, splitter;
    import std.algorithm : joiner, map;

    string message = "fix issue 16319 and fix std.traits.isInnerClass";
    static auto matchToRefs(M)(M m)
        enum splitRE = regex(`[^\d]+`); // ctRegex throws a weird error in
unittest compilation
        return m.captures[5].splitter(splitRE);

    // see
    enum issueRE = ctRegex!(`((close|fix|address)e?(s|d)? )?(ticket|bug|tracker
item|issue)s?:? *([\d ,\+&#and]+)`, "i");

it fails with:

dlang/phobos/std/algorithm/iteration.d(2446): Error: cannot modify struct
copy._items MapResult!(matchToRefs, RegexMatch!(string, BacktrackingMatcher))
with immutable members
dlang/phobos/std/algorithm/iteration.d(2443): Error: function
std.algorithm.iteration.joiner!(MapResult!(matchToRefs, RegexMatch!(string,
BacktrackingMatcher))).joiner.Result.save no return exp; or assert(0); at end
of function
bugzilla.d(16): Error: template instance
std.algorithm.iteration.joiner!(MapResult!(matchToRefs, RegexMatch!(string,
BacktrackingMatcher))) error instantiating

According to digger this is due to:


Jan 07 2017