[Issue 17157] ctRegex.matchAll doesn't set last item in Captures

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Mar 8 05:48:03 PST 2017


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

Dmitry Olshansky <dmitry.olsh at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh at gmail.com

--- Comment #1 from Dmitry Olshansky <dmitry.olsh at gmail.com> ---
(In reply to Alexey Kulentsov from comment #0)

> if comment at line 6 beginning is removed and ctRegex is used then we have
> exception:
> 
> core.exception.AssertError@/usr/include/dmd/phobos/std/regex/package.d(565):
> wrong match: 1..0
> ----------------
> ??:? _d_assert_msg [0x4edba6]
> ??:? std.regex.Captures!(immutable(char)[],
> ulong).Captures.opIndex!().opIndexinout(pure nothrow @trusted
> inout(immutable(char)[]) function(ulong)) [0x4e4f01]
> ??:? _Dmain [0x4bb73e]
> ??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
> [0x4ef333]
> ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
> function(char[][])*).tryExec(scope void delegate()) [0x4ef25b]
> ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
> function(char[][])*).runAll() [0x4ef2d8]
> ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
> function(char[][])*).tryExec(scope void delegate()) [0x4ef25b]
> ??:? _d_run_main [0x4ef1c7]
> ??:? main [0x4eae0f]
> ??:? __libc_start_main [0xc012282f]
> 
> More experiments have shown: last element of match is not set and attempt to
> access it leads to exception. 
> 
> Compiler: DMD64 D Compiler v2.073.0
> OS: Ubuntu 16.04 LTS

Trying to reproduce with latest master (2.074~alpha) I see no exception but the
output of 2 runs differs.
With regex correctly:
0:a 1:a 2: 3: 4: 
0:b 1: 2:b 3: 4: 
0:c 1: 2: 3:c 4: 
0:d 1: 2: 3: 4:d 
With ctRegex:
0:a 1:a 2: 3: 4: 
0:b 1:a 2:b 3: 4: 
0:c 1:a 2: 3:c 4: 
0:d 1:a 2: 3: 4:d 

Investigating...

--


More information about the Digitalmars-d-bugs mailing list