www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14059] New: Formatted write with wrong formatting string

https://issues.dlang.org/show_bug.cgi?id=14059

          Issue ID: 14059
           Summary: Formatted write with wrong formatting string
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

void main() {
    import std.stdio;
    auto a = ["red", "blue"];
    writefln("%-(%s%", a);
}


If compiled normally gives (dmd 2.067alpha):

core.exception.RangeError std\format.d(878): Range violation


Compiling with -release -boundscheck=off gives:

object.Exception ...\dmd2\src\phobos\std\format.d(871): Incorrect format
specifier: %(%s%

I think it should give the second error message in both cases.

--
Jan 27 2015