On Wednesday, 8 July 2015 at 03:31:43 UTC, jmh530 wrote:
I'm still not sure why I'm getting the error I mention in the original post. For instance, the code below is giving that Error 42 Symbol Undefined error. Seems very mystifying...

import std.math : cos;

real foo(T)(T fp, real x)
{
        return fp(x);
}

void main()
{
        real x = 0;
        real y = foo(&cos, x);
}

It seems std.math.cos is an intrinsic function (i.e. one that the compiler implements when needed, or generates the appropriate asm for):
https://github.com/D-Programming-Language/phobos/blob/master/std/math.d#L630

The compiler should probably refuse to take the address of such a function. I've found this bug report:
https://issues.dlang.org/show_bug.cgi?id=4541

Reply via email to