  We prove the following theorem: let $\widetilde{\mathcal R}$ be an expansion
of the real field $\overline{\mathbb R}$, such that every definable set (I) is
a uniform countable union of semialgebraic sets, and (II) contains a
"semialgebraic chunk". Then every definable smooth function $f:X\subseteq
\mathbb R^n\to \mathbb R$ with open semialgebraic domain is semialgebraic.
  Conditions (I) and (II) hold for various d-minimal expansions
$\widetilde{\mathcal R} = \langle \overline{\mathbb R}, P\rangle$ of the real
field, such as when $P=2^\mathbb Z$, or $P\subseteq \mathbb R$ is an iteration
sequence. A generalization of the theorem to d-minimal expansions
$\widetilde{\mathcal R}$ of $\mathbb R_{an}$ fails. On the other hand, we prove
our theorem for expansions$\widetilde{\mathcal R}$ of arbitrary real closed
fields. Moreover, its conclusion holds for certain structures with d-minimal
open core, such as $\langle \overline{\mathbb R}, \mathbb R_{alg}, 2^\mathbb
Z\rangle$.
