[clang-tools-extra] [clang-tidy] fix compilation by disambiguating equality operator (PR #147048)
Gregor Jasny via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 4 06:30:45 PDT 2025
https://github.com/gjasny updated https://github.com/llvm/llvm-project/pull/147048
>From df2f97dcf1c6febd152fe6aed8d60681a93acb8d Mon Sep 17 00:00:00 2001
From: Gregor Jasny <gjasny at googlemail.com>
Date: Fri, 4 Jul 2025 13:19:22 +0100
Subject: [PATCH] [clang-tidy] fix compilation by disambiguating equality
operator
This fixes a compilation issue on Ubuntu 22.04 with the Ubuntu
provided Clang 14 and C++20. That's probably happening due to
incomplete C++20 support in either Clang 14 or the GNU libstdc++ 12.
Signed-off-by: Gregor Jasny <gjasny at googlemail.com>
---
.../clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp
index db0ac281ddfcf..9d1384b54c4f6 100644
--- a/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp
@@ -144,7 +144,7 @@ TaggedUnionMemberCountCheck::getNumberOfEnumValues(const EnumDecl *ED) {
if (EnableCountingEnumHeuristic && LastEnumConstant &&
isCountingEnumLikeName(LastEnumConstant->getName()) &&
- (LastEnumConstant->getInitVal() == (EnumValues.size() - 1))) {
+ (LastEnumConstant->getInitVal() == llvm::APSInt::get(EnumValues.size() - 1))) {
return {EnumValues.size() - 1, LastEnumConstant};
}
More information about the cfe-commits
mailing list