UnresolvedSet::erase works by popping the last element then replacing the element to be erased with that element. When the element to be erased is itself the last element this leads to writing past the end of the set, causing an assertion failure.
Fix this by making erase of the last element just pop that element.
This ODR violation broke the build for me because it's picking up the definition from Decl.h instead of this one.
Maybe it needs to be something like this instead?