Try to coerce Complex with only real part.

This closes #3142.