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

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 4 06:25:13 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:

Should this be `llvm::APSInt::get` (signed getter)?
The previous overload would be:
https://github.com/llvm/llvm-project/blob/ad20dc0a87fc34666dcd75390c149d5ea55a0fbd/llvm/include/llvm/ADT/APSInt.h#L189-L191 

Which uses `llvm::APSInt::get` internally.

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


More information about the cfe-commits mailing list