[Issue 6175] String corruption when passing static char arrays to std.conv

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 4 07:17:06 PST 2012


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



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-01-04 07:17:05 PST ---
This has now changed to a template error:

import std.conv;

void main()
{
    char[9] statCArr = "blablabla";
    auto res1 = to!(char[])(statCArr);
}

D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(237): Error: template
std.conv.toImpl(T,S) if (isImplicitlyConvertible!(S,T)) toImpl(T,S) if
(isImplicitlyConvertible!(S,T)) matches more than one template declaration,
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(245):toImpl(T,S) if
(isImplicitlyConvertible!(S,T)) and
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(350):toImpl(T,S) if
(isStaticArray!(S))

A simple workaround is to pass a slice:
    auto res1 = to!(char[])(statCArr[]);

But since to() seems to have specializations for static arrays I'll leave this
open.

-- 
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