As far as I know, convex optimization problem is defined as a form of
\begin{alignat}{1}
\min_{x \in D} & \quad f(x) \\
\text{subject to} & \quad g(x) \leq 0 \\
& \quad h(x) = 0
\end{alignat}
where, $f(x)$ and $g(x)$ are convex functions, and $h(x)$ is a affine function.
Here, my question is why $g(x)$ should be a convex function.
In my thought, for example, if $g(x)$ is $(x-2)x^2(x+2) - 4$, even though $g(x)$ is not a convex function, $g(x) \leq 0$ has a convex set as a solution. It means the problem can be a convex optimization problem.
Am I right? or what am I missing?