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 @@ -4952,6 +4952,10 @@ return false; if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) return true; + if (Left.is(TT_TemplateCloser) && Right.is(tok::r_paren) && + (!Right.Next || Right.Next->isNot(TT_JsTypeColon))) { + return true; + } if ((Left.is(tok::greater) && Right.is(tok::greater)) || (Left.is(tok::less) && Right.is(tok::less))) { return false; 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 @@ -24868,6 +24868,12 @@ "(\n" ") = nullptr;", Style); + + verifyFormat("static_assert(\n" + " std::is_base_of_v ||\n" + " std::is_base_of_v\n" + ");", + Style); } TEST_F(FormatTest, AlignAfterOpenBracketBlockIndentIfStatement) {