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 @@ -2089,6 +2089,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,8 @@ verifyFormat("f(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" " .template operator()());", getLLVMStyleWithColumns(35)); + verifyFormat("bool_constant"); + verifyFormat("bool_constant"); // Not template parameters. verifyFormat("return a < b && c > d;");