Is $d(x,D)$ smooth outside of $\overline D$? Suppose $D\subset \mathbb R^n$ is a set with some regularity, say bounded with piecewise $C^1$ boundary; define $f(x):=d(x,D):=\inf_{y\in D}|x-y|$. Is this enough to claim that $f$ is smooth outside of $\overline D$? 
(Remark: previous version of question was with sup instead of inf)
 A: In the following image, when moving along the blue line segment,
$f(x)$ is the max of the distance to the top and the distance to the bottom of the red shape, hence look like a transform of $|t|$, not smooth.

Remark: A similar argument works if you really mean the conventional definition of $d(x,D)$, i.e. with $\inf$ instedad of $\sup$.
A: In a comment to the accepted answer, I asked if it is enough to assume $D$ is convex. Here I give an example where $d(x,D)$ is not $C^\infty$. If $D = \{(x,y)\in\mathbb R^2 : x\leq 0,y\leq 0\}$, then
$$ d((x,y),D) = \begin{cases} 0, & (x,y)\in D\\ y, & x\le0,y\ge0 \\ x, & x\ge0,y\le0 \\ \sqrt{x^2+y^2}, & x\ge0,y\ge0.  \end{cases}$$
(the level sets are "translations" of $D$ with a "rounded" corner.) One can easily check that $ d((x,y),D)$ is piecewise smooth away from $D$, but fails to be $C^2$.
A: Assume that $D$ is a closed convex set in $\mathbb{R}^2$ : 
Def : $c$ is a geodesic if $c(t)=p+tv,\ |v|=1$
Def : A geodesic $c(t)
 $ has a foot $f(t)\in D$ if $ d(c(t),f(t))=d(c(t),D)$
EXE1 : A foot $f(t)$ is unique.
EXE2 : Foot $f(t)$ is 1-Lipschitz i.e.
$|f(t)-f(s)|\leq
 |t-s|$ 
Cor : $d(x,D)$ is continuous, more precisely, $2$-Lipschitz
Proof : $$|
  |c(t)-f(t)| -|c(t+\varepsilon )-f(t+\varepsilon )|| <
 2\varepsilon $$
EXE3 : $\pi-\theta(t)=\angle \ (
 \overrightarrow{c(t)f(t)}
 ,\overrightarrow{c(t)c(t+1)} )$ is continuous
Proof : It is followed from $EXE1$
EXE4 : Note that gradient ${\rm grad}\ d(x,D)$ is defined. And it is unit vector.
Proof : Foot is unique so that direction is defined. 
EXE5 - $d(x,D)$ is $C^1$ : If $c$ is a geodesic, then $$\frac{d}{dt} \ d(c(t),D) =
  {\rm grad}\ d(c(t),D)\cdot c'(t) = \cos\ \theta(t)$$ is
  continuous.
EXE6 - Calvin Khor's example : Let $D=\{ (x,y)|
 x,\ y\leq 0\}$ which is convex. Prove that $d(x,D)$ is not $C^2$
Proof : Recall that $\frac{d^2}{dt^2} \ d(c(t),D) =-\sin\
\theta(t)\theta'(t)$.
$c(t)= (t/\sqrt{2},1-t/\sqrt{2})$ is a geodesic. On triangle
$c(0)c(t)(0,0)$, consider cosine law
$$ t^2+|c(t)|^2 -2|c(t)|t \cos\ \theta =1 $$
That is, $\cos\ \theta = \frac{t-1/\sqrt{2}}{ \sqrt{t^2-\sqrt{2} t
+1} }  $ so that $\sin\ \theta =
\frac{1/\sqrt{2}}{\sqrt{t^2-\sqrt{2} t +1}}$
Here $ -\theta'=\sin\ \theta$ so that $\lim_{t\rightarrow 0+}\
\theta'(t) = -1/\sqrt{2}$.
And $\theta(t)$ is constant for $t<0$ so that $\theta'(t)$ is not
continuous.
