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 @@ -964,6 +964,8 @@ if (MacroBlock && FormatTok->is(tok::l_paren)) parseParens(); + Line->Level = InitialLevel; + if (FormatTok->is(tok::kw_noexcept)) { // A noexcept in a requires expression. nextToken(); @@ -979,8 +981,6 @@ if (MunchSemi && FormatTok->is(tok::semi)) nextToken(); - Line->Level = InitialLevel; - if (PPStartHash == PPEndHash) { Line->MatchingOpeningBlockLineIndex = OpeningLineIndex; if (OpeningLineIndex != UnwrappedLine::kInvalidIndex) { 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 @@ -24510,6 +24510,16 @@ " { x * 1 } -> std::convertible_to;\n" " };"); + verifyFormat("template \n" + "concept C = requires(T x) {\n" + " {\n" + " long_long_long_function_call(1, 2, 3, 4, 5)\n" + " } -> long_long_concept_name;\n" + " {\n" + " long_long_long_function_call(1, 2, 3, 4, 5)\n" + " } noexcept -> long_long_concept_name;\n" + " };"); + verifyFormat( "template \n" "concept Swappable = requires(T &&t, U &&u) {\n"