Use class exactness as part of the condition for class compare optimization instead of assert. Reviewed-by: twisti, roland