Thread overview
[Issue 12767] writeln of a struct with toString returning char[N]
May 19, 2014
Andrej Mitrovic
Nov 21, 2015
bb.temp@gmx.com
Mar 21, 2020
Basile-z
May 19, 2014
https://issues.dlang.org/show_bug.cgi?id=12767

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Interesting, I never thought about returning static arrays. Currently as a workaround you could implement a toString that takes a format string and an output range.

--
May 20, 2014
https://issues.dlang.org/show_bug.cgi?id=12767

--- Comment #2 from bearophile_hugs@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);
}

--
November 21, 2015
https://issues.dlang.org/show_bug.cgi?id=12767

bb.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bb.temp@gmx.com
         Resolution|---                         |FIXED

--- Comment #3 from bb.temp@gmx.com ---
2.069 ok

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=12767

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--