Bug 24198 – nothrow keyword ignored on struct destructor

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-10-25T03:48:56Z
Last change time
2024-12-13T19:31:18Z
Assigned to
No Owner
Creator
Christopher Winter
Moved to GitHub: dmd#20344 →

Comments

Comment #0 by christopher.winter — 2023-10-25T03:48:56Z
This code results in an error that "Nothrow.~this` is not `nothrow`", despite it being marked `nothrow`. The error is given at the `scope n = Nothrow()` line. Either the nothrow annotation on the destructor is ignored, or the destructor cannot be marked nothrow with that implementation, in which case that should be the error, with the location given as the malformed destructor. ``` struct ThrowsDestructor { ~this() { } } struct Nothrow { ~this() nothrow @trusted { try { _t = ThrowsDestructor.init; } catch(Exception e) { } } ThrowsDestructor _t; } void test() nothrow { scope n = Nothrow(); } void main() { } ```
Comment #1 by robert.schadek — 2024-12-13T19:31:18Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20344 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB