Discontinuous function with continuous restriction to any smooth curve The famous function
$$f(x,y) = \cases {0,&if $(x,y)=(0,0)$\\
\frac{xy^2}{x^2+y^4} &otherwise}$$
is continuous when restricted to any smooth curve of the form $(x, g(x))$, but is discontinuous at $(0, 0)$ over the curve $(y^3, y)$.
But if a function $f: \mathbb R^2 \rightarrow \mathbb R$ is continuous when restricted to any smooth curve in $\mathbb R^2$, does it need to be continuous?
I would bet on no, but I can not come up with a sound construction at the moment.
What about restrictions only to analytic curves?
 A: If by smooth curves you mean $C^\infty$, we can find a counterexample: let $p_n=(2^{-n},3^{-n})\in\mathbb{R}^2$, and define $f(x)=\sum_{n=1}^\infty f_n(x)$, where $f_n$ is a bump function of height $1$, centered in $p_n$ and with support of diameter $<\frac{1}{10^n}$. This function is continuous at every point except $0$.
For any smooth curve $\gamma(t)$, $f(\gamma(t))$ will be continuous. To prove this is is enough to suppose $\gamma(0)=0$ and check the continuity of $f(\gamma(t))$ at $t=0$. If $\gamma'(0)$ is not a positive multiple of $(1,0)$, it is clear that $f(\gamma(t))$ is continuous (in fact $f(\gamma(t))=0$ in a neighborhood of $0$). So we can assume that $\gamma'(t)=(1,0)$. After a reparametrization, we can assume $\gamma(t)=(t,g(t))$, for $t$ in some neighborhood of $0$ and $g(t)$ a smooth function with $g'(t)=0$. As $g$ is twice differentiable, we have $|g(t)|<M(t^2)$ for $t$ in a nhood $(-\varepsilon,\varepsilon)$ of $0$ and for some constant $M$. Now, picking $k$ such that $2^{-k}+10^{-k}<\varepsilon$ and $3^{-k}-10^{-k}>M((2^{-k}+10^{-k})^2$, we will have that $\gamma(t)$ is outside the support of $f_n$ for all $t\in\left(0,2^{-k}+10^{-k}\right)$. Indeed, if $t$ is not inside some interval $(2^{-n}-10^{-n},2^{-n}+10^{-n})$, it is clear that $\gamma(t)$ is not in the support of any $f_n$. While if $t\in(2^{-n}-10^{-n},2^{-n}+10^{-n})$ for some $n$, then $n\leq k$ and $g(t)<M(2^{-n}+10^{-n})^2<3^{-n}-10^{-n}$, so $\gamma(t)$ cannot be in the support of $f_n$.
So $f(\gamma(t))=0$ for $t\in\left(0,2^{-k}+10^{-k}\right)$, and clearly it is also $0$ in $(-\delta,0)$ for some $\delta$, so $f(\gamma(t))$ is differentiable at $0$.$\\[20pt]$
If by smooth you just mean $C^1$, that changes everything: for any function $f$ not continuous at $0$ we can find a $C^1$ curve $\gamma(t)$ such that $\gamma(0)=0$, $\gamma'(0)\neq0$ and $f(\gamma(t))$ is not continuous at $t=0$.
To do this, suppose $f(0)=0$ and consider a sequence of points $p_n\to 0$ with $|f(p_n)|>\varepsilon$ for some $\varepsilon>0$. Now take $v\in\mathbb{S}^1$ to be a cluster point of the sequence $\frac{p_n}{|p_n|}$. After a rotation we can suppose that $v=(1,0)$. Taking a subsequence if necessary, we can suppose $\frac{p_n}{|p_n|}\to(1,0)$. Letting $x_n,y_n$ be the coordinates of $p_n$, this just means that $\frac{y_n}{x_n}\to0$.
So, given a sequence of points $p_n=(x_n,y_n)$ with $x_n\to0^+$ and $\frac{y_n}{x_n}\to0$, we just need to find a $C^1$ function $h(x)$ whose graph passes through a subsequence of $p_n$. Indeed, then for the $C^1$ curve given by $\gamma(t)=(t,h(t))$, $f(\gamma(t))$ would not be continuous at 0, because $f(\gamma(0))=0$ and $|f(\gamma(x_n))|=|f(x_n,y_n)|>\varepsilon$ $\forall n$.
We can construct such a function $h$ using, once again, bump functions. Let $\phi:\mathbb{R}\to\mathbb{R}$ be a bump function centered at $0$, of height $1$ and support of diameter $<1$ (note that $\phi'$ is bounded). And now, once again change $p_n$ for a subsequence in such a way that:
$\bullet\frac{x_n}{y_n}<\frac{1}{2^n}\;\forall n$.
$\bullet x_{n+1}<\frac{x_n}{2}\;\forall n$.
The function we are going to use is $f(x)=\sum_{i=1}^\infty \phi_n(x)$, where $\phi_n(x)=y_n\phi(\frac{3(x-x_n)}{x_n})$ is a bump function of height $y_n$, center $x_n$ and support of diameter $<\frac{x_n}{3}$. The supports of all the $\phi_n$ are disjoint, so we just have to check two things:
$\bullet f'(0)=0$: This is easy using that $\frac{y_n}{x_n}\to 0$.
$\bullet \lim_{t\to0}f'(t)=0$. This follows from the fact that, if $M$ is a bound for $\phi'(x)$, then $3M\frac{y_n}{x_n}$ is a bound for $\phi_n'(x)$.
