On 5/25/22 1:40 AM, frame wrote:

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.


It's a case where the compiler can't divine what you were thinking when you wrote that code ;)

remember that the expression `fun` where fun is a *function*, and not a *function pointer*, is the equivalent of `fun()`.

It can't figure out that you really thought `fun` was a function pointer, maybe it thinks that you are missing an overload? Maybe fun actually is a no-arg function, and the result isn't comparable against null (or maybe it is, and it compiles and does something completely different!).

But I'm glad you discovered the issue.

-Steve

Reply via email to