Bug 17494 – Do not execute scope(...) if an Error exception has been thrown

Status
REOPENED
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-12T00:09:46Z
Last change time
2024-12-13T18:52:34Z
Keywords
pull
Assigned to
No Owner
Creator
Walter Bright
See also
https://issues.dlang.org/show_bug.cgi?id=17493
Moved to GitHub: dmd#19261 →

Comments

Comment #0 by bugzilla — 2017-06-12T00:09:46Z
Not cleaning up after an Error is thrown is allowed by the D spec. This enhancement allows much better code to be generated for `nothrow` code when `scope` is used. It will also not unwind declarations with destructors in `nothrow` code when Errors are thrown. It also fixes regression https://issues.dlang.org/show_bug.cgi?id=17493
Comment #1 by bugzilla — 2017-06-12T00:16:04Z
Comment #2 by code — 2017-06-17T08:41:47Z
Test Case from Vladimir https://github.com/dlang/dmd/pull/6816#issuecomment-307657520 struct S { ~this() {} } class C { S s; this() nothrow {} }
Comment #3 by github-bugzilla — 2017-06-17T10:16:16Z
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/558773e64d42d56ad02970adfdc1371311ca3291 add test cases for existing production code - fixes Issues 17494, 17505, 17506
Comment #4 by github-bugzilla — 2017-08-07T13:16:47Z
Commit pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/558773e64d42d56ad02970adfdc1371311ca3291 add test cases for existing production code
Comment #5 by moonlightsentinel — 2020-09-05T14:48:37Z
This issue was never fixed: ===================================== import core.stdc.stdio : puts; void main() { scope (exit) puts("Hello, World!"); throwError(); } void throwError() { throw new Error(""); } ===================================== Hello, World! object.Error@(0) ---------------- onlineapp.d:11 void onlineapp.throwError() [0x5579194b2bea] onlineapp.d:6 _Dmain [0x5579194b2b78]
Comment #6 by dlang-bot — 2020-10-24T00:34:16Z
@WalterBright updated dlang/dmd pull request #6896 "fix Issue 17494 - Do not execute scope(...) if an Error exception has…" fixing this issue: - fix Issue 17494 - Do not execute scope(...) if an Error exception has been thrown https://github.com/dlang/dmd/pull/6896
Comment #7 by robert.schadek — 2024-12-13T18:52:34Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19261 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB