Suppose $\Omega \subset \mathbb{R}$ is a bounded domain. Then using Poincare-Wirtinger, one can prove that for functions $f \in W^{1,2}(\Omega)$ there exists $C>0$ such that
$$\|u\|_{L^{2}}^{2} \le C\|u'\|_{L^{2}}^{2} + C\left( \int u(x)~dx \right)^{2}. $$
Question: Suppose we have a function $u$ which satisfies
$$ \|u'\|_{L^{2}}^{2} + \left( \int u(x)~dx \right)^{2} \le C . $$
Can we conclude that $u \in W^{1,2}(\Omega)$? The reason I am not sure is because in order for us to use the first inequality we need that $u \in W^{1,2}(\Omega)$ which a-priori we don't have. I think the statement could be true and we can prove it by some density argument but I am not sure how to proceed.
If $\Omega$ has regular boundary (say Lipshitz) you can use the fact that since $u' \in L^2(\Omega)$ then by Sobolev-Morrey inequality, $u\in C^{0,\alpha}(\Omega)$ for some $\alpha>0$, and so is bounded on $\Omega$. This implies that $u\in L^2$ since $\Omega$ is bounded.