newCTFE Status August 2019
Jon Degenhardt
jond at noreply.com
Sat Aug 31 21:44:38 UTC 2019
On Thursday, 15 August 2019 at 21:42:47 UTC, Stefan Koch wrote:
> Hi Guys,
>
> I had 2 weeks of vacation recently, and I used them to work on
> newCTFE again.
> [...]
>
> That said, I am hopeful to be able to release newCTFE in 2020!
Hi Stefan,
Great that you're still getting some time to work on this!
By coincidence, I just ran into a case. I'm curious, will newCTFE
enable the usage below?
------------------
$ cat ctfe_case.d
struct C
{
import std.conv : to;
string s = double.init.to!string; // Fails to compile.
}
void main()
{
import std.stdio;
C c;
writeln(c.s);
}
$ dmd ctfe_case.d
/Library/D/dmd/src/phobos/std/exception.d(515): Error: uncaught
CTFE exception std.format.FormatException("Cannot format floating
point types at compile-time")
ctfe_case.d(4): called from here: to(nan)
---------------
Using a similar code construct in a function works fine:
----------------
$ cat ctfe_case2.d
void main()
{
import std.stdio;
import std.conv : to;
string s = double.init.to!string;
writeln(s);
}
$ dmd ctfe_case2.d
$ ./ctfe_case2
nan
-----------------
--Jon
More information about the Digitalmars-d
mailing list