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.
Comment #1 by robert.schadek — 2024-12-01T16:33:38Z