Convert a few assert failures into proper errors.

Fixes PR25944.

llvm-svn: 257697
13 files changed