[clang] use correct builtin type for defaulted comparison analyzer
authorMatheus Izvekov <mizvekov@gmail.com>
Sun, 6 Jun 2021 01:20:25 +0000 (03:20 +0200)
committerMatheus Izvekov <mizvekov@gmail.com>
Thu, 17 Jun 2021 00:08:31 +0000 (02:08 +0200)
commitb88eb855b53184161ad1ea0eea1962100941cf0b
tree5f9fafa828b527675b73bc0d0574cb9ac99265e0
parent0a07343e34fc84052e6cc54e55654412b0ed01f4
[clang] use correct builtin type for defaulted comparison analyzer

Fixes PR50591.

When analyzing classes with members which have user-defined conversion
operators to builtin types, the defaulted comparison analyzer was
picking the member type instead of the type for the builtin operator
which was selected as the best match.

This could either result in wrong comparison category being selected,
or a crash when runtime checks are enabled.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D103760
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/class/class.compare/class.spaceship/p2.cpp