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.
/Users/jonathan_roelofs/llvm-upstream/clang/unittests/AST/UnresolvedSetTest.cpp:30:1: error: call to implicitly-deleted default constructor of 'UnresolvedSetTest' TEST_F(UnresolvedSetTest, Size) { EXPECT_EQ(set.size(), 4u); } ^ /Users/jonathan_roelofs/llvm-upstream/third-party/unittest/googletest/include/gtest/gtest.h:2368:3: note: expanded from macro 'TEST_F' GTEST_TEST_(test_fixture, test_name, test_fixture, \ ^ /Users/jonathan_roelofs/llvm-upstream/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1362:5: note: expanded from macro 'GTEST_TEST_' GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ ^ /Users/jonathan_roelofs/llvm-upstream/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1351:3: note: expanded from macro 'GTEST_TEST_CLASS_NAME_' test_suite_name##_##test_name##_Test ^ <scratch space>:30:1: note: expanded from here UnresolvedSetTest_Size_Test ^ /Users/jonathan_roelofs/llvm-upstream/clang/unittests/AST/UnresolvedSetTest.cpp:19:13: note: default constructor of 'UnresolvedSetTest' is implicitly deleted because field 'n0' has no default constructor NamedDecl n0, n1, n2, n3; ^Maybe it needs to be something like this instead?