PR21323: Fix iterator invalidation issue when looking for redeclarations of a
special member function.

No test yet: the only testcases we have for this issue are extremely complex.
Testcase will be added once I get a reasonable reduction.