Well, we have found an easy-to-detect crash bug now.
I have no idea how many rarely-trodden code paths were touched as well and might now break. No problem about the ++it changes, but I'm a bit suspicious about the pointer casts. (Not to mention that the extra code required for the dynamic casts by far exceeds the benefit from the ++it optimization.)