www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9669] New: Throw in a pre-condition of a nothrow function

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

           Summary: Throw in a pre-condition of a nothrow function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-03-08 12:12:26 PST ---
This code compiles with dmd 2.063alpha:


void foo() nothrow
in {
    throw new Exception(null);
} body {
}
void main() {
    foo();
}



Then it throws at runtime:

object.Exception test.d(3)
---------
0x00402044 in nothrow void test.foo() at ...
...


I think that's bad because I think the "nothrow" tag used by the compiler to
better optimize functions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2013