diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -1437,6 +1437,7 @@ if (Style.PackConstructorInitializers > FormatStyle::PCIS_BinPack) { CurrentState.AvoidBinPacking = true; CurrentState.BreakBeforeParameter = + Style.ColumnLimit > 0 && Style.PackConstructorInitializers != FormatStyle::PCIS_NextLine && Style.PackConstructorInitializers != FormatStyle::PCIS_NextLineOnly; } else { 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 @@ -7758,6 +7758,13 @@ " aaaaaaaaaaaaaaaaaaaa(a),\n" " bbbbbbbbbbbbbbbbbbbbb(b) {}", Style); + + Style = getLLVMStyleWithColumns(0); + Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; + verifyFormat("Foo(Bar bar, Baz baz) : bar(bar), baz(baz) {}", Style); + verifyNoChange("Foo(Bar bar, Baz baz)\n" + " : bar(bar), baz(baz) {}", + Style); } TEST_F(FormatTest, AllowAllArgumentsOnNextLine) {