[Issue 2479] sformat is broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 29 14:45:41 PDT 2009


Brad Roberts <braddr at puremagic.com> changed:

           What    |Removed                     |Added
                 CC|                            |braddr at puremagic.com

--- Comment #2 from Brad Roberts <braddr at puremagic.com>  2009-08-29 14:45:40 PDT ---
A reduced test case (larger, but complete and doesn't import large swaths of
code).  This is a massive reduction of all the irrelevant parts of doFormat
torn away, and sformat reduced a good bit as well.

module bug2479;

import std.stdarg;

void doFormat(void delegate(dchar) myputc, TypeInfo[] arguments, va_list
    string fmt = va_arg!(string)(argptr);
    assert(!(fmt is null)); // fires when it shouldn't.

char[] sformat(char[] s, ...)
    void putc(dchar c) { s[0] = cast(char)c; }

    doFormat(&putc, _arguments, _argptr);
    return s[0 .. 1];

void main()
    char[32] tmp;
    sformat(tmp, "%s", "hi");

Changing putc to not touch 's' causes the va_arg call to succeed an fmt is no
longer null.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

More information about the Digitalmars-d-bugs mailing list