Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -3964,7 +3964,7 @@ return Style.BreakBeforeConceptDeclarations == FormatStyle::BBCDS_Always; return Style.AlwaysBreakTemplateDeclarations == FormatStyle::BTDS_Yes; } - if (Left.ClosesRequiresClause) { + if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) { switch (Style.RequiresClausePosition) { case FormatStyle::RCPS_OwnLine: case FormatStyle::RCPS_WithPreceding: Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -23853,6 +23853,11 @@ "}", Style); + verifyFormat("template \n" + "int bar(T t)\n" + " requires F;", + Style); + Style.IndentRequiresClause = false; verifyFormat("template \n" "requires F\n" @@ -23873,6 +23878,7 @@ verifyFormat("template requires Foo struct Bar {};\n" "template requires Foo void bar() {}\n" "template void bar() requires Foo {}\n" + "template void bar() requires Foo;\n" "template requires Foo Bar(T) -> Bar;", Style); @@ -23925,6 +23931,9 @@ "void bar()\n" "requires Foo {}\n" "template \n" + "void bar()\n" + "requires Foo;\n" + "template \n" "requires Foo Bar(T) -> Bar;", Style); @@ -23984,6 +23993,7 @@ "template \n" "void bar() requires Foo\n" "{}\n" + "template void bar() requires Foo;\n" "template requires Foo\n" "Bar(T) -> Bar;", Style);