www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15924] New: [Home]

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

          Issue ID: 15924
           Summary: [Home]
           Product: D
           Version: D2
          Hardware: x86_64
               URL: http://dlang.org/
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: keepitsimplesirius gmail.com

Following code raises assertion failure (buffer.data() returns empty string).
With the marked line it passes. It seems like formattedWrite is unable to write
to empty appender.

import std.array;
import std.format;

int main() {
    Appender!string buffer;
    // buffer.put(""); // with this line it passes
    formattedWrite(buffer, "foo");
    assert("foo" == buffer.data());
    return 0;
}

--
Apr 14 2016