www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21358] New: conv.to array to string seems to lack nothrow


          Issue ID: 21358
           Summary: conv.to array to string seems to lack nothrow
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;

void main () nothrow
    int[] arr;
    auto str1 = "[" ~ arr.map!(elem => elem.to!string).join(",") ~ "]";  // ok
    auto str2 = arr.to!string;  // not nothrow ?

I don't quite understand why `to!string` would fail for arrays. Does it throw
exceptions on OOM conditions? But if that's the case it should throw an Error,
not an Exception.

Nov 02 2020