July 22, 2014 [Issue 13185] New: Detect precondition violations at compile time when possible | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13185 Issue ID: 13185 Summary: Detect precondition violations at compile time when possible Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: contracts Severity: enhancement Priority: P1 Component: DMD Assignee: yebblies@gmail.com Reporter: yebblies@gmail.com In many cases, the compiler can easily detect that a function call cannot possibly pass the precondition. int divide(int x, int y) in { assert(y != 0); } body { return x / y; } void main() { func(3); divide(9, 0); } In these cases we can produce an error at compile time. -- |
Copyright © 1999-2021 by the D Language Foundation