[Issue 21358] New: conv.to array to string seems to lack nothrow
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 3 01:47:00 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21358
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 at puremagic.com
Reporter: andrej.mitrovich at 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.
--
More information about the Digitalmars-d-bugs
mailing list