Skip to content

Commit f1ff857

Browse files
committed
[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 <[email protected]>
1 parent 274e798 commit f1ff857

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ TaggedUnionMemberCountCheck::getNumberOfEnumValues(const EnumDecl *ED) {
144144

145145
if (EnableCountingEnumHeuristic && LastEnumConstant &&
146146
isCountingEnumLikeName(LastEnumConstant->getName()) &&
147-
(LastEnumConstant->getInitVal() == (EnumValues.size() - 1))) {
147+
llvm::APSInt::compareValues(LastEnumConstant->getInitVal(),
148+
llvm::APSInt::get(EnumValues.size() - 1)) ==
149+
0) {
148150
return {EnumValues.size() - 1, LastEnumConstant};
149151
}
150152

0 commit comments

Comments
 (0)