[clang-tools-extra] [clang-tidy][NFC] fix compilation by disambiguating equality operator (PR #147048)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 4 06:44:31 PDT 2025


================
@@ -144,7 +144,8 @@ TaggedUnionMemberCountCheck::getNumberOfEnumValues(const EnumDecl *ED) {
 
   if (EnableCountingEnumHeuristic && LastEnumConstant &&
       isCountingEnumLikeName(LastEnumConstant->getName()) &&
-      (LastEnumConstant->getInitVal() == (EnumValues.size() - 1))) {
+      (LastEnumConstant->getInitVal() ==
+       llvm::APSInt::getUnsigned(EnumValues.size() - 1u))) {
----------------
vbvictor wrote:

> From the error: `(with operand types 'llvm::APSInt' and 'unsigned long')` I was assuming that the `(EnumValues.size() - 1)` gets converted to an `unsigned long`

Yeah, but checking source code I suppose `bool operator==(uint64_t RHS) const` doesn't exist for llvm::APSInt

https://github.com/llvm/llvm-project/pull/147048


More information about the cfe-commits mailing list