[Sema] cast to CXXRecordDecl correctly when diag a default comparison method
authorCongcong Cai <congcongcai0907@163.com>
Thu, 25 May 2023 20:07:48 +0000 (22:07 +0200)
committerCongcong Cai <congcongcai0907@163.com>
Thu, 25 May 2023 20:07:50 +0000 (22:07 +0200)
commit5df593a354714e081ac441a74f89ad2a56334e28
tree89c52594163f955f5da97ff5481f91591207b0c9
parent361a8226f981252bd8b152e9d0f2b47c7a25c266
[Sema] cast to CXXRecordDecl correctly when diag a default comparison method

Fixed: https://github.com/llvm/llvm-project/issues/62791
Fixed: https://github.com/llvm/llvm-project/issues/62102
in c++20, default comparison is supported. `getLexicalDeclContext` maybe cannot
get the `CXXRecord` if default comparison defined out of `CXXRecord`.
This patch want to get these information from the first function argument.

Reviewed By: #clang-language-wg, erichkeane

Differential Revision: https://reviews.llvm.org/D151365
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
clang/test/SemaCXX/cxx20-default-compare.cpp [new file with mode: 0644]