<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63865>63865</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            ClangFormat C++11 brace initialization aligns arguments in columns
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          yuriisk
      </td>
    </tr>
</table>

<pre>
    The bug can be reproduced with default ClangFormat config.

The code gets formatted in columns as follows
```cpp
  MyData some_variable{long_parameter, very_very_long_parameter, short_param,
 another_param,  something_else, 10};
```

Expected formatting is
```cpp
  MyData some_variable{long_parameter, very_very_long_parameter, short_param,
 another_param, something_else, 10};
```

I think the behavior can be fixed in `clang/lib/Format/FormatToken.cpp`:

```diff
--- a/clang/lib/Format/FormatToken.cpp
+++ b/clang/lib/Format/FormatToken.cpp
@@ -194,10 +194,10 @@
   }
 
 // In C++11 braced list style, we should not format in columns unless they
-  // have many items (20 or more) or we allow bin-packing of function call
+  // have many items (20 or more) and we allow bin-packing of function call
   // arguments.
-  if (Style.Cpp11BracedListStyle && !Style.BinPackArguments &&
-      Commas.size() < 19) {
+  if (Style.Cpp11BracedListStyle && (!Style.BinPackArguments ||
+ Commas.size() < 20)) {
     return;
   }
 
```

Per my understanding, the code shouldn't be formatted in columns if either (1) bin-packing is disabled or (2) the number of items is less than 20.

I'm using clang-format version 16.0.6

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVU2PozgQ_TXOpRSEDYHkwKFDb6SWdqWRdu4tAwV4Y2xkm_Rkfv2qIKEzs61Vz542QsEq7Fdf75Wl96oziAXbHdnueSOn0FtXXCenlD9vKttci689QjV1UEsDFYLD0dlmqrGBNxV6aLCVkw5Qamm6k3WDDFBb06ouYvEzi5-Wf0KpbYPQYfDQzvsCNqAM1FZPg_Egya61ffO3g1m8PPU4LhaAP67PMkj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