October 25, 2023 [Issue 24198] New: nothrow keyword ignored on struct destructor | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24198 Issue ID: 24198 Summary: nothrow keyword ignored on struct destructor Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: christopher.winter@ahrefs.com 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() { } ``` -- |
Copyright © 1999-2021 by the D Language Foundation