mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 01:58:44 +08:00
[Clang] Fix cast to BigIntType in hasUniqueObjectRepresentations
A bad QualType cast caused us not to detect _BigInt types if they were wrapped inside sugar types like SubstTemplateTypeParm. Fix https://github.com/llvm/llvm-project/issues/62019 Reviewed By: cjdb Differential Revision: https://reviews.llvm.org/D147904
This commit is contained in:
@@ -2832,7 +2832,7 @@ bool ASTContext::hasUniqueObjectRepresentations(QualType Ty) const {
|
||||
// All integrals and enums are unique.
|
||||
if (Ty->isIntegralOrEnumerationType()) {
|
||||
// Except _BitInt types that have padding bits.
|
||||
if (const auto *BIT = dyn_cast<BitIntType>(Ty))
|
||||
if (const auto *BIT = Ty->getAs<BitIntType>())
|
||||
return getTypeSize(BIT) == BIT->getNumBits();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -2970,6 +2970,12 @@ namespace ErrorType {
|
||||
bool b = __has_unique_object_representations(T);
|
||||
};
|
||||
|
||||
static_assert(!has_unique_object_representations<_BitInt(7)>::value, "BitInt:");
|
||||
static_assert(has_unique_object_representations<_BitInt(8)>::value, "BitInt:");
|
||||
static_assert(!has_unique_object_representations<_BitInt(127)>::value, "BitInt:");
|
||||
static_assert(has_unique_object_representations<_BitInt(128)>::value, "BitInt:");
|
||||
|
||||
|
||||
namespace PR46209 {
|
||||
// Foo has both a trivial assignment operator and a non-trivial one.
|
||||
struct Foo {
|
||||
|
||||
Reference in New Issue
Block a user