www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14159] New: Bug in ctRegex - "Error: found 'else' instead of


          Issue ID: 14159
           Summary: Bug in ctRegex - "Error: found 'else' instead of
           Product: D
           Version: D2
          Hardware: Other
                OS: Other
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: Dbugs m3.sent.com

The following regular expression string (valid as it works in non-compile time
regex) causes the "Error: found 'else' instead of statement" compile time

"/usr/include/dmd/phobos/std/regex.d-mixin-5885(5943): Error: found 'else'
instead of statement"

import std.regex;

auto commentRx = ctRegex!(`.*?(//.*[\r\n]|/\*(?:.|[\r\n])*?\*/)`, "gm");

void main() {}

This is as observed on hackerrank.com which used D Version 2.066.

See https://www.hackerrank.com/environment

Feb 09 2015