[phobos] FreeBSD 32 still fails unittests for std.datetime

Jonathan M Davis jmdavisProg at gmx.com
Mon May 2 23:09:09 PDT 2011


> I see functions marked with "nothrow", but inside they have:
> 
>      try {
>        ...
>      }
>      catch (Exception e)
>      {
>             assert(0, "FracSec's constructor threw when it shouldn't
> have"); }
> 
> This is redundant, and adds significant bloat. The compiler will statically
> check that the nothrow is enforced for you.

No, those _are_ required. One or more functions in the try block aren't 
nothrow. Logically, they _can't_ throw, but the compiler doesn't know that. 
So, I have to add the try-catch block so that the compiler won't scream about 
it. The assert(0) then ensures that the function fails if the logic is bad and 
the function _can_ throw.

- Jonathan M Davis


More information about the phobos mailing list