Here is a piece of code that should be good but fails:
import std.stdio;
int eval(int c)
{
if (c > 0)
{
try
{
//writeln("Try harder!");
return eval(c - 1);
}
catch (Exception e)
{
writeln("GOOD ", c, ": ", e.msg);
return 0;
}
}
else
{
throw new Exception("Something exceptional right here");
}
}
int main()
{
try
{
return eval(1);
}
catch (Exception e)
{
writeln("FAILED: ", e.msg);
}
return 1;
}
Fun thing is, you can ask dmd to try harder (uncomment above) at it works. Same behavior seen with ldc2 and gdc.
Comment #2 by elpenguino+D — 2019-05-10T07:48:50Z
This appears to be a regression introduced by the 2.066.0 release.
Comment #3 by robert.schadek — 2024-12-13T19:03:21Z