This revision was automatically updated to reflect the committed changes. Closed by commit rG016970d079c4: [Clang] Fix cast to BigIntType in hasUniqueObjectRepresentations (authored by royjacobson).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147904/new/ https://reviews.llvm.org/D147904 Files: clang/lib/AST/ASTContext.cpp clang/test/SemaCXX/type-traits.cpp Index: clang/test/SemaCXX/type-traits.cpp =================================================================== --- clang/test/SemaCXX/type-traits.cpp +++ clang/test/SemaCXX/type-traits.cpp @@ -2970,6 +2970,12 @@ 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 { Index: clang/lib/AST/ASTContext.cpp =================================================================== --- clang/lib/AST/ASTContext.cpp +++ clang/lib/AST/ASTContext.cpp @@ -2832,7 +2832,7 @@ // 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;
Index: clang/test/SemaCXX/type-traits.cpp =================================================================== --- clang/test/SemaCXX/type-traits.cpp +++ clang/test/SemaCXX/type-traits.cpp @@ -2970,6 +2970,12 @@ 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 { Index: clang/lib/AST/ASTContext.cpp =================================================================== --- clang/lib/AST/ASTContext.cpp +++ clang/lib/AST/ASTContext.cpp @@ -2832,7 +2832,7 @@ // 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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits