[Issue 20394] New: "one path skips constructor" when exception is thrown
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 15 13:07:56 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20394
Issue ID: 20394
Summary: "one path skips constructor" when exception is thrown
Product: D
Version: D2
Hardware: All
URL: http://dlang.org/
OS: All
Status: NEW
Severity: normal
Priority: P3
Component: dmd
Assignee: nobody at puremagic.com
Reporter: the.mail.of.mi2 at gmail.com
struct X
{
this(int a)
{
if(a == 0)
this(a, 1);
else
throw new Exception("");
}
this(int a, int b) {}
}
The code above fails to compile with "one path skips constructor" error. It can
be worked around by adding "assert(0);" to the else block, but shoudn't
throwing exception be enough?
--
More information about the Digitalmars-d-bugs
mailing list