[Issue 2369] is(T == function) does not recognize function pointers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 4 15:11:20 PDT 2008


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





------- Comment #2 from snake.scaly at gmail.com  2008-10-04 17:11 -------
The type is called function, you create a value of that type using the function
keyword, so I expected the is(T==function) to detect this type.
I think the whole is(==) system works strangely.  Let's take four cases:

void foo() {}
class Bar { void bar() {} }
Bar b;

typeof(foo)    // (void())()
typeof(&foo)   // void function()
typeof(b.bar)  // (void())()
typeof(&b.bar) // void delegate()

is(T==function) only true for typeof(foo)
is(T==delegate) only true for typeof(&b.bar)
is(T:T*) is false for any of them.

I'd really like more predictable behavior.


-- 



More information about the Digitalmars-d-bugs mailing list