pragma(msg, is( void delegate() == delegate).stringof); // true pragma(msg, is( void function() == function).stringof); // false
This is apparently intentional. I recently brought up the same issue on the NG: http://www.digitalmars.com/d/archives/digitalmars/D/The_bizarre_world_of_typeof_99461.html#N99486 Quoting Don: "real function()" is a *function pointer*, but is(xxx == function) tests to see if xxx is a *function*, not a *function pointer*.
So what is the proper way to test if something is a function pointer then? It seems horribly inconsistent with delegates.
One way to test: is(typeof(*T.init) == function)
I'll mark this invalid, since the language lawyers (IANALL) say it is, and the better solution now that it exists is std.traits.isFunctionPointer.