[Issue 20301] New: std.regex.regex doesn't accept a const/immutable array of patterns

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 15 09:53:47 UTC 2019


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

          Issue ID: 20301
           Summary: std.regex.regex doesn't accept a const/immutable array
                    of patterns
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: petar.p.kirov at gmail.com

void main()
{
    import std.regex;
    const arr1 = ["a", "b"];
    auto re1 = regex(arr1);

    immutable arr2 = ["a", "b"];
    auto re2 = regex(arr2);

}

Fails to compile with:
/dlang/dmd-nightly/linux/bin64/../../src/phobos/std/regex/package.d(385):
Error: cannot modify const expression pat
/dlang/dmd-nightly/linux/bin64/../../src/phobos/std/regex/package.d(388):
Error: cannot modify const expression pat
...

Fix incoming.

--


More information about the Digitalmars-d-bugs mailing list