[Issue 5666] std.array.replace compile error (string and immutable string)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 10 14:37:48 PST 2011


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


Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario at gmx.de


--- Comment #5 from Rainer Schuetze <r.sagitario at gmx.de> 2011-03-10 14:34:41 PST ---
Very much related is this issue with join in dmd 2.052:

import std.string;

void main()
{
    string[] a = ["1","2","3"];
    join(a,std.string.newline);
}

test.d(6): Error: template std.array.join(RoR,R) if (isInputRange!(RoR) &&
isInputRange!(ElementType!(RoR)) && isForwardRange!(R)) does not match any
function template declaration
test.d(6): Error: template std.array.join(RoR,R) if (isInputRange!(RoR) &&
isInputRange!(ElementType!(RoR)) && isForwardRange!(R)) cannot deduce template
function from argument types !()(string[],immutable(char[2u]))

This worked in 2.051, aswell as the code with replace in the original report.

I consider these regressions, because the functions should just work with
immutable string arguments. The user should not be bothered with the internals
of the implementation of these functions. IIRC the regression happened because
both functions are now based on ranges in std.array, whereas there were some
special string implementations in std.string before.

The new implementations would probably work if creating a copy of a value of
type "immutable char[]" (as done when passing a function argument to
replace/join) would allow implicite conversion to immutable(char)[].

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


More information about the Digitalmars-d-bugs mailing list