to! fails with fixed length char array for dmd 2.051

stephan none at example.com
Thu Jan 6 04:18:32 PST 2011


The following code worked fine with dmd 2.050, but fails to compile for dmd
2.051. Any reason for this (other than a bug)?

import std.conv;

void main() {
    char[4] t = "test";
    auto s = to!(dstring)(t);
}

Error message seems to indicate that two templates match, one checking for
isStaticArray, and one checking for isSomeString:

C:\D2\dmd2\windows\bin\..\..\src\phobos\std\conv.d(99): Error: template
std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) &&
isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) toImpl(T,S) if
(!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S))
&& isSomeChar!(ElementType!(S))) matches more than one template declaration,
C:\D2\dmd2\windows\bin\..\..\src\phobos\std\conv.d(114):toImpl(T,S) if
(!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S))
&& isSomeChar!(ElementType!(S))) and
C:\D2\dmd2\windows\bin\..\..\src\phobos\std\conv.d(224):toImpl(T,S) if
(isStaticArray!(S))


More information about the Digitalmars-d-learn mailing list