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 @@ -185,6 +185,8 @@ } else { CurrentToken->setType(TT_TemplateCloser); } + if (CurrentToken->Next && CurrentToken->Next->Tok.isLiteral()) + return false; next(); return true; } 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 @@ -10365,6 +10365,7 @@ // Not template parameters. verifyFormat("return a < b && c > d;"); + verifyFormat("a < 0 ? b : a > 0 ? c : d;"); verifyFormat("void f() {\n" " while (a < b && c > d) {\n" " }\n"