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 @@ -2066,6 +2066,10 @@ return TT_UnaryOperator; const FormatToken *NextToken = Tok.getNextNonComment(); + + if (InTemplateArgument && NextToken && NextToken->is(tok::kw_noexcept)) + return TT_BinaryOperator; + if (!NextToken || NextToken->isOneOf(tok::arrow, tok::equal, tok::kw_noexcept) || NextToken->canBePointerOrReferenceQualifier() || 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 @@ -9512,6 +9512,7 @@ verifyFormat("f(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" " .template operator()());", getLLVMStyleWithColumns(35)); + verifyFormat("bool_constant"); // Not template parameters. verifyFormat("return a < b && c > d;");