  We show that a function $f : X \to \mathbb R$ defined on a closed uniformly
polynomially cuspidal set $X$ in $\mathbb R^n$ is real analytic if and only if
$f$ is smooth and all its composites with germs of polynomial curves in $X$ are
real analytic. The degree of the polynomial curves needed for this is
effectively related to the regularity of the boundary of $X$. For instance, if
the boundary of $X$ is locally Lipschitz, then polynomial curves of degree $2$
suffice. In this Lipschitz case, we also prove that a function $f : X \to
\mathbb R$ is real analytic if and only if all its composites with germs of
quadratic polynomial maps in two variables with images in $X$ are real
analytic; here it is not necessary to assume that $f$ is smooth.
