Bug 18812 – template enforce should accept same parameter combos as exception

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-04-29T23:13:00Z
Last change time
2024-12-01T16:33:38Z
Assigned to
No Owner
Creator
elpenguino+D
Moved to GitHub: phobos#10333 →

Comments

Comment #0 by elpenguino+D — 2018-04-29T23:13:00Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10333 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB