On Wednesday, 25 May 2022 at 04:34:43 UTC, Steven Schveighoffer wrote:

Well, you can possibly work around the type system, but I don't know what the compiler thinks you have there.

This really bothers me and I put this test cases:


```d
static if (isSomeFunction!fun) pragma(msg,...)
static if (isFunctionPointer!fun) pragma(msg,...)
static if (isCallable!fun) pragma(msg,...)
```

It output mostly true except in one case where the compiler really sees a function, not a pointer.

Thanks, now the difference is clear to me, Adam was right. I guess I have forgotten some version-switch somewhere and it tries to compile none-suitable code which will be never used in runtime at this point.

This would have been more visible if the compiler just says: "function cannot be compared against null, only function pointer". That function vs function pointer is too subtle.

Reply via email to