[Issue 21405] New: ctRegex doesn't work in compile time
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 19 04:07:44 UTC 2020
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 at puremagic.com
Reporter: nocomentsspb at 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()
--
More information about the Digitalmars-d-bugs
mailing list