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: [email protected]
Reporter: [email protected]
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:
[email protected](18): hello
Expected result: code does not throw exception.
--