It is well-known that if $f$ is twice differentiable at $a$, then
$$ f''(a) = \lim_{h\to 0} \frac{f(a+2h)-2f(a+h) + f(a)}{h^2}. $$
See e.g. this question or this question.
On the other hand, the RHS limit may exist without $f$ being twice differentiable. For instance, if $f(x) = x^3 \sin(1/x)$ for $x\neq 0$ and $f(0)=0$, then at $a=0$ the RHS is $2h(4\sin(1/2h) - \sin(1/h))$, which has limit $0$; but this function $f$ is not twice differentiable at $0$.
My question is, under what additional hypotheses can we conclude from the existence of the RHS limit that $f$ is twice differentiable?
We probably need to assume that $f$ is once differentiable on a neighborhood of $a$, but that is not sufficient since the counterexample above is in fact smooth at all points $x\neq 0$. For the same reason, it is not sufficient to assume that the above limit exists for all $a$ in some neighborhood.
Note that this is not the same as this question, which is asking for a limit definition of the second derivative that doesn't require extra hypotheses; here I'm asking what extra hypotheses can be added to this particular definition to make it work.