FunctionTypeOf behaves unexpectedly for function pointers?

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 29 06:54:13 PDT 2016


This failure seems curious and I haven't been able to understand 
why it occurs, or whether it might be intentional. For all other 
callable types, including functions and delegates and types 
implementing opCall, the assertion passes.

     import std.traits : FunctionTypeOf;
     void function() func;
     // Error: static assert  (is(void() == void function())) is 
false
     static assert(is(FunctionTypeOf!func == typeof(func)));



More information about the Digitalmars-d-learn mailing list