digitalmars.D.bugs - [Issue 18812] New: template enforce should accept same parameter
- d-bugmail puremagic.com (31/31) Apr 29 2018 https://issues.dlang.org/show_bug.cgi?id=18812
https://issues.dlang.org/show_bug.cgi?id=18812 Issue ID: 18812 Summary: template enforce should accept same parameter combos as exception Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: elpenguino+D gmail.com Currently, the enforce!SomeException form of enforce can use only msg/file/line combinations. I believe this is an unnecessary restriction and this form of enforce should be able to use any constructor for SomeException as long as enforce's parameters match up - for example: ` class SomeException : Exception { uint somethingMeaningful; this(uint a) { somethingMeaningful = a; super("Something went wrong!"); } } enforce!SomeException(false, 4); ` Removing this restriction would be a HUGE usability improvement and would make this much more viable in nogc code. --
Apr 29 2018