By an influential theorem of Boman, a function f on an open set U in R d is smooth (C ∞ ) if and only if it is arc-smooth, i.e., f •c is smooth for every smooth curve c : R → U . In this paper we investigate the validity of this result on closed sets. Our main focus is on sets which are the closure of their interior, so-called fat sets. We obtain an analogue of Boman's theorem on fat closed sets with Hölder boundary and on fat closed subanalytic sets with the property that every boundary point has a basis of neighborhoods each of which intersects the interior in a connected set. If X ⊆ R d is any such set and f : X → R is arc-smooth, then f extends to a smooth function defined on R d . We also get a version of the Bochnak-Siciak theorem on all closed fat subanalytic and all closed sets with Hölder boundary: if f : X → R is the restriction of a smooth function on R d which is real analytic along all real analytic curves in X, then f extends to a holomorphic function on a neighborhood of X in C d . Similar results hold for non-quasianalytic Denjoy-Carleman classes (of Roumieu type). We will also discuss sharpness and applications of these results.