[Issue 1373] New: typeof(func).stringof fails when func has parameters.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 25 02:39:18 PDT 2007


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

           Summary: typeof(func).stringof   fails when func has parameters.
           Product: D
           Version: 1.019
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


If func is a function (not a function pointer) with zero arguments, it works
correctly (I think). But if it is a function with >0 arguments, then it
complains that it cannot evaluate it.

Curiously, it generates the correct result, as evidenced by pragma(msg) below,
before giving the error.

--------------
double func0() { return 0; }
int func2(int a, int b) { return 2; }

void main()
{  
    static assert(typeof(func0).stringof=="(double())()"); // OK
    pragma(msg, typeof(func2).stringof);
    // bug.d(8): Error: expected 2 arguments, not 0
    // (int(int a, int b))()
    static assert(typeof(func2).stringof=="(int(int a, int b))()");
}


-- 



More information about the Digitalmars-d-bugs mailing list