Ellery Newcomer:

pragma(msg, typeof(a)); // void function()

Maybe pragma(msg) needs to print function pointer types with a "*", to help remember it's a pointer:

int foo1() pure nothrow @safe { return 0; }
void main() {
    static assert(is(typeof(foo1) == function));
    auto foo2 = { return 0; };
    static assert(is(typeof(*foo2) == function));
    pragma(msg, typeof(foo1));
    pragma(msg, typeof(foo2));
}


Prints:

pure nothrow @safe int()
int function() pure nothrow @safe

From such printout I am not able to tell the first one is a function type and the second is the type of a function pointer :-(

Bye,
bearophile

Reply via email to