digitalmars.D.bugs - [Issue 17381] New: Checked format string is permissive after
- via Digitalmars-d-bugs (27/27) May 07 2017 https://issues.dlang.org/show_bug.cgi?id=17381
https://issues.dlang.org/show_bug.cgi?id=17381 Issue ID: 17381 Summary: Checked format string is permissive after floating point argument Product: D Version: D2 Hardware: All OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: acehreli yahoo.com A float argument eliminates subsequent orphan argument checks. import std.format; void main() { static assert(!__traits(compiles, format!"%s"(1.5, 2))); } static assert fails because the expression should not compile because there is an orphan argument. (In real code, it would compile but throw FormatException at runtime.) Replacing %s with %f does not make a difference; it still compiles. You can have more arguments before the floating point argument; it always breaks the subsequent orphan argument checks. Ali --
May 07 2017