From f1ff857dd5a6751255884b4fa4c347f7fe7b7a2a Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Fri, 4 Jul 2025 13:19:22 +0100 Subject: [PATCH 1/2] [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 --- .../clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp index db0ac281ddfcf..0cb6971e3efcf 100644 --- a/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp @@ -144,7 +144,9 @@ TaggedUnionMemberCountCheck::getNumberOfEnumValues(const EnumDecl *ED) { if (EnableCountingEnumHeuristic && LastEnumConstant && isCountingEnumLikeName(LastEnumConstant->getName()) && - (LastEnumConstant->getInitVal() == (EnumValues.size() - 1))) { + llvm::APSInt::compareValues(LastEnumConstant->getInitVal(), + llvm::APSInt::get(EnumValues.size() - 1)) == + 0) { return {EnumValues.size() - 1, LastEnumConstant}; } From 6e0628054e93e231a2958f175b665c56421f1b68 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Mon, 7 Jul 2025 20:22:45 +0200 Subject: [PATCH 2/2] fixup! [clang-tidy] fix compilation by disambiguating equality operator --- .../clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp index 0cb6971e3efcf..c1ea63cda5003 100644 --- a/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp @@ -144,9 +144,8 @@ TaggedUnionMemberCountCheck::getNumberOfEnumValues(const EnumDecl *ED) { if (EnableCountingEnumHeuristic && LastEnumConstant && isCountingEnumLikeName(LastEnumConstant->getName()) && - llvm::APSInt::compareValues(LastEnumConstant->getInitVal(), - llvm::APSInt::get(EnumValues.size() - 1)) == - 0) { + llvm::APSInt::isSameValue(LastEnumConstant->getInitVal(), + llvm::APSInt::get(EnumValues.size() - 1))) { return {EnumValues.size() - 1, LastEnumConstant}; }