[Issue 20797] New: Destructor marked as nothrow renders try-catch block useless
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 5 04:04:13 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20797
Issue ID: 20797
Summary: Destructor marked as nothrow renders try-catch block
useless
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: razvan.nitu1305 at gmail.com
struct K
{
~this() nothrow {}
}
void main()
{
static class C
{
this(K, int) {}
}
static int foo(bool flag)
{
if (flag)
throw new Exception("hello");
return 1;
}
try
{
new C(K(), foo(true));
}
catch(Exception)
{
}
}
Result:
object.Exception at test.d(18): hello
Expected result: code does not throw exception.
--
More information about the Digitalmars-d-bugs
mailing list