Bug 5152 – std.conv fails to convert a char[] to string after update to dmd 2.050
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2010-11-01T12:44:00Z
Last change time
2011-01-22T15:57:33Z
Assigned to
andrei
Creator
juanjux
Comments
Comment #0 by juanjux — 2010-11-01T12:44:01Z
Test code:
import std.conv;
void main()
{
char[4] test = ['a', 'b', 'c', 'd'];
string fail = to!string(test);
}
This fails with some template ambiguity (it seems):
/home/juanjux/sync/work/d/dmd2/src/phobos/std/conv.d(95): 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, /home/juanjux/sync/work/d/dmd2/src/phobos/std/conv.d(110):toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) and /home/juanjux/sync/work/d/dmd2/src/phobos/std/conv.d(220):toImpl(T,S) if (isStaticArray!(S))
Notice too how the error message is a nightmare - it doesn't specify the source file where the failed "to!" is.