Thread overview
[Issue 2438] New: Cannot get types of delegate properties
Nov 01, 2008
d-bugmail
Nov 01, 2008
d-bugmail
Nov 01, 2008
d-bugmail
November 01, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2438

           Summary: Cannot get types of delegate properties
           Product: D
           Version: 2.020
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: samukha@voliacable.com


alias void delegate() Dg;
alias typeof(Dg.ptr) Ptr;
alias typeof(Dg.funcptr) Funcptr;
----
test.d(13): Error: argument void* to typeof is not an expression
test.d(13): Error: argument void* to typeof is not an expression
test.d(14): Error: void delegate() is not an lvalue

Worked around by defining an intermediate delegate instance:
alias void delegate() Dg;
Dg dummy;
alias typeof(dummy.ptr) Ptr;
alias typeof(dummy.funcptr) Funcptr;


-- 

November 01, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2438





------- Comment #1 from jarrett.billingsley@gmail.com  2008-11-01 09:19 -------
Not that I don't think it's a bug, but - what the heck?  I honestly can't tell what Dg.ptr is.  The compiler doesn't accept it as a type, but it also doesn't accept it as an expression.  Dg.ptr.stringof gives "void*", as if it's a type. I'm kind of surprised that you can access it at all.

Also, another workaround is to use typeof(Dg.init.ptr/funcptr).


-- 

November 01, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2438





------- Comment #2 from samukha@voliacable.com  2008-11-01 10:47 -------
typeof(Dg.init.funcptr) fails:
Error: null is not an lvalue

BTW, typeof((int[]).ptr) works as expected


--