Bug 11262 – std.regex.replace does not accept StaticRegex

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-14T12:03:00Z
Last change time
2013-10-17T02:00:43Z
Keywords
pull
Assigned to
nobody
Creator
Jesse.K.Phillips+D

Comments

Comment #0 by Jesse.K.Phillips+D — 2013-10-14T12:03:21Z
When using a ctRegex for replace, the compiler is unable to locate a proper overload. This worked in 2.63. import std.regex; void main() { enum reg = ctRegex!(r",", "g"); auto str = "This,List"; str = str.replace(reg, "-"); } -------------- C:\opt\dmd\windows\bin\..\..\src\phobos\std\regex.d(6107): Error: template std.regex.repla ceMatchesInto does not match any function template declaration. Candidates are: C:\opt\dmd\windows\bin\..\..\src\phobos\std\regex.d(6067): std.regex.replaceMatches Into(alias output, Sink, R, T)(ref Sink sink, R input, T matches) if (isOutputRange!(Sink, dchar) && isSomeString!R && is(T == RegexMatch!R)) C:\opt\dmd\windows\bin\..\..\src\phobos\std\regex.d(6107): Error: template std.regex.repla ceMatchesInto(alias output, Sink, R, T)(ref Sink sink, R input, T matches) if (isOutputRan ge!(Sink, dchar) && isSomeString!R && is(T == RegexMatch!R)) cannot deduce template functi on from argument types !(__lambda4)(Appender!string, string, RegexMatch!(string, Backtrack ingMatcher)) C:\opt\dmd\windows\bin\..\..\src\phobos\std\regex.d(6099): Error: function std.regex.repla ce!(match, string, char, StaticRegex!char).replace.replaceAllWith!((m, sink) => replaceFmt (format, m, sink), match, string, StaticRegex!char).replaceAllWith no return exp; or asser t(0); at end of function C:\opt\dmd\windows\bin\..\..\src\phobos\std\regex.d(6393): Error: template instance std.re gex.replace!(match, string, char, StaticRegex!char).replace.replaceAllWith!((m, sink) => r eplaceFmt(format, m, sink), match, string, StaticRegex!char) error instantiating .\regct.d(6): instantiated from here: replace!(match, string, char, StaticRegex!cha r) .\regct.d(6): Error: template instance std.regex.replace!(match, string, char, StaticRegex !char) error instantiating
Comment #1 by dmitry.olsh — 2013-10-15T12:54:37Z
Comment #2 by dmitry.olsh — 2013-10-15T13:16:58Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/8f00475ef27cd6382500b8296ae7f23ed3c8fe16 too tight constraint that has no use in private function Fixes issue 1262
Comment #3 by dmitry.olsh — 2013-10-17T02:00:43Z
*** Issue 11285 has been marked as a duplicate of this issue. ***