https://issues.dlang.org/show_bug.cgi?id=14685

          Issue ID: 14685
           Summary: Silent incorrect behavior with enforce and custom
                    exception
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: [email protected]
          Reporter: [email protected]

Today, I wrote the following code:

/////////////// test.d //////////////
import std.exception;

class NotFoundException : Exception
{
    this() { super("Not found"); }
}

void main()
{
    enforce!NotFoundException(false);
}
/////////////////////////////////////

It compiles fine, but does not actually throw anything.

This seems to be a regression, as previously it did not compile.

Introduced in https://github.com/D-Programming-Language/phobos/pull/2288

--

Reply via email to