digitalmars.D.bugs - [Issue 20394] New: "one path skips constructor" when exception is
- d-bugmail puremagic.com (29/29) Nov 15 2019 https://issues.dlang.org/show_bug.cgi?id=20394
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 puremagic.com Reporter: the.mail.of.mi2 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? --
Nov 15 2019