Let\[f(x) = \left\{ \begin{array}{cl} 2x + 7 & \text{if } x < -2, \\ -x^2 - x + 1 & \text{if } x \ge -2. \end{array} \right.\]Find the sum of all values of $x$ such that $f(x) = -5.$
2x+ 7 = -5 implies x = -6 since this is less than -2 it is a valid solution
-x^2 - x + 1 = -5 can be written as x^2 + x - 6 = 0 which factors as (x-2)(x+3)=0 for which the only solution that is greater than or equal to -2 is x = 2.
Hence the sum of the valid values of x is -6 + 2 = -4