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: nob...@puremagic.com
          Reporter: acehr...@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

--

Reply via email to