[Issue 17546] New: Cannot call .stringof on a function symbol if it does not have a no-args overload

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 24 10:38:08 PDT 2017


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

          Issue ID: 17546
           Summary: Cannot call .stringof on a function symbol if it does
                    not have a no-args overload
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: monkeyworks12 at hotmail.com

int test()
{
    return 0;
}

void main()
{
    pragma(msg, test.stringof);
}

It seems that the only way to make this work is add a no-args overload of
`test`. It still seems that something weird is going on if I do that, however:

int test()
{
    return 0;
}

void main()
{
        //Prints "test()"
    pragma(msg, test.stringof);
}

Currently I am resorting to a hacky workaround by doing
`(&test).stringof[2..$]`.

--


More information about the Digitalmars-d-bugs mailing list