diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -144,6 +144,8 @@ if (Previous.Previous) { if (Previous.Previous->Tok.isLiteral()) return false; + if (Previous.Previous->is(tok::r_brace)) + return false; if (Previous.Previous->is(tok::r_paren) && Contexts.size() > 1 && (!Previous.Previous->MatchingParen || !Previous.Previous->MatchingParen->is( diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -10679,6 +10679,7 @@ // Not template parameters. verifyFormat("return a < b && c > d;"); verifyFormat("a < 0 ? b : a > 0 ? c : d;"); + verifyFormat("ratio{-1, 2} < ratio{-1, 3} == -1 / 3 > -1 / 2;"); verifyFormat("void f() {\n" " while (a < b && c > d) {\n" " }\n"