Bug 9669 – Throw in a pre-condition of a nothrow function

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-08T12:12:26Z
Last change time
2020-03-21T03:56:38Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-03-08T12:12:26Z
This code compiles with dmd 2.063alpha: void foo() nothrow in { throw new Exception(null); } body { } void main() { foo(); } Then it throws at runtime: [email protected](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.