Summary: Assert errors should be unrecoverable.
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD

void main() {

void foo(int i) nothrow {
    assert(i < 0);
    return i;

Compiles in release mode because asserts are disabled.  When asserts are
enabled, compilation fails w/ the following error msg:

test.d|5|function 'foo' is nothrow yet may throw

Fixing this is necessary to allow some code that doesn't throw any "real"
exceptions, but uses asserts for internal consistency checks, to compile in
debug mode.  Also, if asserts are used in the precondition block instead of in
the body, then the code compiles:

void foo(int i) nothrow
in {
    assert(i < 0);
} body {
    return i;


Reply via email to