[Clang] Fix lambda CheckForDefaultedFunction(...) so that it checks the CXXMethodDecl...
authorShafik Yaghmour <shafik.yaghmour@intel.com>
Sat, 3 Sep 2022 00:45:44 +0000 (17:45 -0700)
committerShafik Yaghmour <shafik.yaghmour@intel.com>
Sat, 3 Sep 2022 01:59:15 +0000 (18:59 -0700)
commit9f6b3199d33c146937f29feb62e123f34138f770
tree206fe27278429c09d1f4db653b30e75f2aff028b
parent38941da066a7b785ba4771710189172e94e37824
[Clang] Fix lambda CheckForDefaultedFunction(...) so that it checks the CXXMethodDecl is not deleted before attempting to call DefineDefaultedFunction(...)

I discovered this additional bug at the end of working on D132906

In Sema::CheckCompletedCXXClass(...)  uses a lambda CheckForDefaultedFunction to
verify each CXXMethodDecl holds to the expected invariants before passing them
on to CheckForDefaultedFunction.

It is currently missing a check that it is not deleted, this adds that check and
a test that crashed without this check.

This fixes: https://github.com/llvm/llvm-project/issues/57516

Differential Revision: https://reviews.llvm.org/D133177
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/constant-expression-cxx2a.cpp