[Issue 12181] New: to!string fails on arrays of floats

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 16 05:11:42 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12181

           Summary: to!string fails on arrays of floats
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: turkeyman at gmail.com


--- Comment #0 from Manu <turkeyman at gmail.com> 2014-02-16 05:11:38 PST ---
Should this work?

 enum float[4] x = [0,1,2,3]; // fixed array
 pragma(msg, to!string(x));

1>src\db\performance.d(159): Error: template std.conv.to does not match any
function template declaration. Candidates are:
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(276):       
std.conv.to(T)
1>src\db\performance.d(159): Error: template std.conv.to(T) cannot deduce
template function from argument types !(string)(float[4])
1>src\db\performance.d(160):        while evaluating pragma(msg, s)


Another:

 enum float[] x = [0,1,2,3]; // dynamic array
 pragma(msg, to!string(x));

1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\math.d(3892): Error: Cannot
convert &real to ushort* at compile time
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(1568):        called
from here: isNaN(cast(real)val)
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(2373):        called
from here: formatValue(w, val, f)
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(2185):        called
from here: formatElement(w, front(val), f)
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(1904):        called
from here: formatRange(w, obj, f)
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(107):        called
from here: formatValue(w, src, f)
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(866):        called
from here: toStr(value)
1>C:\dev\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(281):        called
from here: toImpl(_param_0)
1>src\db\performance.d(159):        called from here: to([0.000000F, 1.00000F,
2.00000F, 3.00000F])
1>src\db\performance.d(160):        while evaluating pragma(msg, s)


It does seem to work with arrays of int's.

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


More information about the Digitalmars-d-bugs mailing list