[Issue 24198] New: nothrow keyword ignored on struct destructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 25 03:48:56 UTC 2023
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 at puremagic.com
Reporter: christopher.winter at 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()
{
}
```
--
More information about the Digitalmars-d-bugs
mailing list