Does locally smooth imply globally smooth for a function on a manifold?

Say we have a function $$f$$ from a differentiable manifold $$M$$ to $$\mathbb{R}$$ such that for all points $$m \in M$$ there exists a neighborhood $$U \ni m$$ such that $$f | U$$ is smooth. Can we conclude that $$f$$ is smooth?

I'm trying to figure this out given the definition of smoothness from Warner's book, namely: "Let $$U \subset M$$ be open. We say that $$f : U \to \mathbb{R}$$ is a $$C^\infty$$ function on U if $$f \circ \phi^{-1}$$ is $$C^\infty$$ for each coordinate map $$\phi$$ on $$M$$."

Yes, like on $$\mathbb R^n$$, smoothness is a local property. A function is (globally) smooth iff its restriction to any open set is a smooth function.
To prove it strictly using your definition, you should let your domain $$U$$ be $$M$$, and let $$\phi:V\to \tilde V$$ be a coordinate map on $$M$$. Then play around with your local smoothness assumption to reduce it to "smooth iff locally smooth" on $$\mathbb R^n$$.