Fixed #5041 (Improve check: support 'auto' for 'Iterator used after element has been erased')