4 ms·
So, the compiler finds out that the function pointer Do is either undefined or points to EraseAll, and since calling an undefined function is undefined behavior
by sddfd 9y ago
So, the compiler finds out that the function pointer Do is either undefined or points to EraseAll, and since calling an undefined function is undefined behavior, the compiler assumes that 'Do' always points to EraseAll?
Is this what is happening?
While this is certainly unexpected, I can't fault the compiler here. The example emphasizes the need for tools to check for undefined behavior.