diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -3537,7 +3537,8 @@ switch (FormatTok->Previous->Tok.getKind()) { case tok::coloncolon: // Nested identifier. case tok::ampamp: // Start of a function or variable for the - case tok::pipepipe: // constraint expression. + case tok::pipepipe: // constraint expression. (binary) + case tok::exclaim: // The same as above, but unary. case tok::kw_requires: // Initial identifier of a requires clause. case tok::equal: // Initial identifier of a concept declaration. break; 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 @@ -24109,6 +24109,15 @@ "concept DelayedCheck = false || requires(T t) { t.bar(); } && " "sizeof(T) <= 8;"); + verifyFormat("template \n" + "concept DelayedCheck = Unit && !DerivedUnit;"); + + verifyFormat("template \n" + "concept DelayedCheck = Unit && !(DerivedUnit);"); + + verifyFormat("template \n" + "concept DelayedCheck = Unit && !!DerivedUnit;"); + verifyFormat("template \n" "concept DelayedCheck = !!false || requires(T t) { t.bar(); } " "&& sizeof(T) <= 8;");