In Sema::CheckCompletedCXXClass(...) It used a lambda CheckForDefaultedFunction the CXXMethodDecl passed to CheckForDefaultedFunction may not be a special member function and so before attempting to apply functions that only apply to special member functions it needs to check. It fails to do this before calling DefineDefaultedFunction(...). This PR adds that check and test to verify we no longer crash.
This fixes https://github.com/llvm/llvm-project/issues/57431
I realized that based on the constraints on the functions called in DefineDefaultedFunction we also should be checking isDeleted() as well but based on the way I drafted this PR I should just do a follow-up.