[Issue 12767] writeln of a struct with toString returning char[N]

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 20 03:38:23 PDT 2014


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

--- Comment #2 from bearophile_hugs at eml.cc ---
A workaround is to call the toString method:


struct Foo {
    char[3] toString() const pure {
        return ['F', 'o', 'o'];
    }
}
void main() {
    import std.stdio;
    Foo f;
    writeln(f.toString);
}

--


More information about the Digitalmars-d-bugs mailing list