[Issue 17442] New: regex purity issues
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat May 27 00:30:09 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17442
Issue ID: 17442
Summary: regex purity issues
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: braddr at puremagic.com
At least two of the functions in std.regex that ought to be usable in a pure
context aren't. I suspect there's a broader issue with that subsystem, but
haven't investigated.
---------
module bugregex;
string unifyNewLine(string str) pure
{
import std.regex;
return std.regex.replace(str, regex(`\r\n|\r|\n`, "g"), "\n");
}
---------
$ dmd -c -ofbugregex.o bugregex.d
bugregex.d(7): Error: pure function 'bugregex.unifyNewLine' cannot call impure
function 'std.regex.regex!string.regex'
bugregex.d(7): Error: pure function 'bugregex.unifyNewLine' cannot call impure
function 'std.regex.replace!(match, string, char, Regex!char).replace'
--
More information about the Digitalmars-d-bugs
mailing list