4 ms·
It should just be res.fn = (void *)fn; `res.fn` is of type `void *`, so that's what the code should be casting to. Casting to `func0Ptr` there seems to j
by comex 1y ago
It should just be
res.fn = (void *)fn;
`res.fn` is of type `void *`, so that's what the code should be casting to. Casting to `func0Ptr` there seems to just be a mistake. Some compilers may allow the resulting function pointer to then implicitly convert to `void *`, but it's not valid in standard C++, hence the error.
Separately from that, if you enable -Wpedantic, you can get a warning for conversions between function and data pointers even if they do use an explicit cast, but that's not the default.