[Issue 17875] New: Range violation in std.regex

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 4 08:13:43 UTC 2017


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

          Issue ID: 17875
           Summary: Range violation in std.regex
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com

import std.regex;
import std.array;
import std.stdio;

unittest {
    auto f = `abc`;
    auto re = `(()|(.+))`;
    writeln(f.matchAll(re)); // Line 8
    writeln(f.matchAll(re).array); // Line 9
}

In the above example, line 9 fails with:

core.exception.RangeError at D:\github\phobos\std\regex\package.d(576): Range
violation

Changing the order of line 8 and 9, the problem disappears. Duplicating line 8
causes no exception.

The regex is shortened to the smallest I found that exhibits this behavior.

--


More information about the Digitalmars-d-bugs mailing list