http://d.puremagic.com/issues/show_bug.cgi?id=2618

           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
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: dsim...@yahoo.com


void main() {
    foo(1);
}

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 test.foo '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