Suppose we have two points $(x_0, y(x_0))$ and $(x_1, y(x_1))$.
I want to find the path $y(x)$ that minimizes the distance between both points with some particular constraints:
$y\in C^\infty$. We want all the derivatives of $y$ to be continuous (because we're solving for a real-life scenario)
The slope and height of the initial point are dependent of each other, such that $f(y(x_0), y'(x_0))=0$. Where $f$ is known.
One such case would be that in which $(x_0, y(x_0))$ lies on the surface of an unit circle and $y'(x_0)$ is tangent to the circle.
Let $P_0$, $P_1$ be the two points and $\theta$ the fixed angle formed by the tangent at $P_0$ and line $P_0P_1$. If $\theta=0$ the shortest path is segment $P_0P_1$.
If $\theta\ne0$ consider the path formed by a first segment $P_0P_2$ of length $x$ making an angle of $\theta$ with $P_0P_1$, joined to segment $P_2P_1$. This path is not smooth but one can approximate it with a $C^\infty$ curve whose length is as close as one wants to the length of the path.
That path has obviously a length $L$ greater than $P_0P_1$, but $L\to P_0P_1$ as $x\to0$. Hence there is no minimum: you can find a smooth path with the requested characteristics whose length is as close as you like to distance $P_0P_1$, but can never reach that minimum value, which is possible only for a straight line.
To make the problem meaningful you must add some other constraint, e.g. a maximum curvature of the path.