digitalmars.D.bugs - [Issue 21405] New: ctRegex doesn't work in compile time
- d-bugmail puremagic.com (36/36) Nov 18 2020 https://issues.dlang.org/show_bug.cgi?id=21405
https://issues.dlang.org/show_bug.cgi?id=21405 Issue ID: 21405 Summary: ctRegex doesn't work in compile time Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: nocomentsspb gmail.com When I try to compile following code: ----------- t.d ------------------ import std.regex; string test(string s)() { auto ctr = ctRegex!(`^.*/([^/]+)/?$`); auto c = matchFirst(s, ctr); return s; } immutable x = test!("test"); void main() { } ---------------------- I see $ dmd t.d /usr/lib/dmd/2.093/import/std/regex/package.d(456): Error: reinterpreting cast from immutable(Regex!char)* to Regex!char* is not supported in CTFE /usr/lib/dmd/2.093/import/std/regex/package.d(832): called from here: prog.getRe() /usr/lib/dmd/2.093/import/std/regex/package.d(995): called from here: matchOnce(input, re) t.d(5): called from here: matchFirst("test", ctr) t.d(9): called from here: test() --
Nov 18 2020