Doctor J wrote:
Answered my own question:

    static if (is(typeof(func0) == function))
        writefln("func0 is a function.");

is() really wants a type, not an expression.

You say you want to test whether a struct/class member is a field or a property. Pointers to class and struct methods are delegates, not function pointers.

    http://www.digitalmars.com/d/1.0/type.html#delegates

So the correct thing to write would be:

    static if (is(typeof(func0) == delegate)) { ... }

or, to test whether func0 is a function OR a delegate,

    static if (is(typeof(func0) == return)) { ... }

For details, see
    http://www.digitalmars.com/d/1.0/expression.html#IsExpression

-Lars

Reply via email to