Ellery Newcomer:

import std.stdio;

void main() {
    auto a = {
        writeln("hi");
    };
    pragma(msg, typeof(a)); // void function()
    pragma(msg, is(typeof(a) == delegate)); // nope!
    pragma(msg, is(typeof(a) == function)); // nope!
}

There is a subtle difference between function type, type of
function pointer and delegate type.


int foo1() { return 0; }
void main() {
     static assert(is(typeof(foo1) == function));
     auto foo2 = { return 0; };
     static assert(is(typeof(*foo2) == function));
}

Bye,
bearophile

Reply via email to