Smooth functions $C^\infty(D)$ are always dense in $W^{1,p}(D)$ when $1\leq p<\infty$. This is a classical result of Meyers and Serrin and you can find it in any textbook on Sobolev spaces. However, the functions are smooth in the interior and their befaviour at the boundary can be pretty bad, if the domain is bad. >Can $C^\infty_{c}({\overline{D}})$ become dense in $W^{1,2}(D)$ without the extension operator? Yes it can! The following result is Corollary 1.2 in [1]: >**Theorem.** If $\Omega$ is a planar Jordan domain, then $C^\infty(\mathbb{R}^2)$ is dense in $W^{1,p}(\Omega)$ for any $1\leq p <\infty$. The result is pretty surprising, since the boundary of a planar Jordan domain can have positive 2-dimensional Lebesgue measure. This and many other Jordan domains are not a Sobolev extension domains. >When smooth functions $C^\infty_{c}({\overline{D}})(=C^\infty_{c}(\mathbb{R}^d)|_{\overline{D}})$ are dense in $W^{1,2}(D)$ ? There are no known characterizations of such a domians and I believe that perhaps except for planar dominas it will not be possible to find such a characterization. **[1] P. Koskela, Y. R.-Y. Zhang,** A density problem for Sobolev spaces on planar domains. *Arch. Ration. Mech. Anal.* 222 (2016), no. 1, 1–14. [arXiv][1] [1]: https://arxiv.org/abs/1508.01400