[Issue 14685] New: Silent incorrect behavior with enforce and custom exception

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jun 11 12:55:31 PDT 2015


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: nobody at puremagic.com
          Reporter: thecybershadow at gmail.com

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

--


More information about the Digitalmars-d-bugs mailing list