http://d.puremagic.com/issues/show_bug.cgi?id=9579

           Summary: std.regex.replace format argument should not require
                    same constness as target string
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2013-02-23 17:03:25 PST ---
Code:

// This works:
auto re = regex(`a`, "g");
string input = "abc";
auto r = replace(input, re, "($1)");

// This gives a compile error:
auto re = regex(`a`, "g");
char[] input;
auto r = replace(input, re, "($1)");

The reason is that when input is char[], replace expects the format string to
also be char[], but "($1)" is, by default, of type string. But this is
unreasonable, because the constness of the format string shouldn't be tied to
the constness of the target string!

(Yes, DMD's IFTI has some limitations, it should be able in infer char[]
instead of immutable(char)[], but regardless, there's no reason why the format
argument must be char[].)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to