[Clang] Fix ClassifyImplicitMemberAccess to handle cases where the access in an uneva...
authorShafik Yaghmour <shafik.yaghmour@intel.com>
Tue, 14 Mar 2023 23:27:55 +0000 (16:27 -0700)
committerShafik Yaghmour <shafik.yaghmour@intel.com>
Tue, 14 Mar 2023 23:37:58 +0000 (16:37 -0700)
commitc41be8fc741dec82e6c628d0cad742285be293f6
tree350b29794f57753e86be2a523275295df4d8a99c
parent59fe64ae47d29fd846f0753a6e61e3dc8d97ecdb
[Clang] Fix ClassifyImplicitMemberAccess to handle cases where the access in an unevaluated context is not within a CXXRecordDecl or CXXMethodDecl

ClassifyImplicitMemberAccess assumes that if we are not in a static context then
the DeclContext must be a CXXRecordDecl or a CXXMethodDecl. In the case of the
unevaluated context this may not be true.

This will lead to a crash because contextClass will remain a nullptr.

Fixes: https://github.com/llvm/llvm-project/issues/37792
Fixes: https://github.com/llvm/llvm-project/issues/48405

Differential Revision: https://reviews.llvm.org/D142490
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaExprMember.cpp
clang/test/SemaCXX/cxx1y-generic-lambdas.cpp
clang/test/SemaCXX/statements.cpp