[Issue 9588] New: format prints "null" for struct functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 25 15:07:39 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9588

           Summary: format prints "null" for struct functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-02-25 15:07:36 PST ---
import std.string;
import std.stdio;

void main()
{
    struct S { int x; bool empty() { return false; } }
    writeln( format("%s", S()) );
}

> S(0, null)

It shouldn't try to print the function. I think this should also apply to
property functions since e.g. "empty" is typically a property function.

-- 
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