Thread overview
[Issue 21358] conv.to array to string seems to lack nothrow
Jul 07, 2022
Andrej Mitrovic
Dec 17, 2022
Iain Buclaw
July 07, 2022
https://issues.dlang.org/show_bug.cgi?id=21358

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
The problem is that to!() uses FormatSpec under the hood for types it doesn't
specialize on.

In particular it calls `toStr`, which itself uses this:

-----
import std.array : appender;
import std.format.spec : FormatSpec;
import std.format.write : formatValue;

auto w = appender!T();
FormatSpec!(ElementEncodingType!T) f;
formatValue(w, src, f);
return w.data;
-----

Internally FormatSpec tries to parse any format specs (like "%s") and does other types of conversions like to!int which can throw exceptions, hence it cannot be nothrow.

I think this issue can be fixed as part of the larger @nogc / nothrow plans in https://forum.dlang.org/thread/qkfwgqslqnuyjgidldkv@forum.dlang.org.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21358

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 01
https://issues.dlang.org/show_bug.cgi?id=21358

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10443

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--