diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 2bb6565193cec..e925bee44cd0c 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -137,7 +137,7 @@ class AnnotatingParser { bool parseAngle() { if (!CurrentToken || !CurrentToken->Previous) return false; - if (NonTemplateLess.count(CurrentToken->Previous)) + if (NonTemplateLess.count(CurrentToken->Previous) > 0) return false; const FormatToken &Previous = *CurrentToken->Previous; // The '<'. diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 96c2dbf11eecd..4f72166bdce2d 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -10656,8 +10656,8 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) { verifyFormat("f(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" " .template operator()());", getLLVMStyleWithColumns(35)); - verifyFormat("bool_constant"); - verifyFormat("bool_constant"); + verifyFormat("bool_constant;"); + verifyFormat("bool_constant;"); verifyFormat("if (std::tuple_size_v > 0)");