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

    <tr>
        <th>Summary</th>
        <td>
            BinPackParameters splits template-template parameters in two
        </td>
    </tr>

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

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

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

<pre>
    This class template:

```cpp
template <typename AAA, typename BBB, typename CCC, template <typename> class DDD>
class SomeTemplate;
```

with this `.clang-format`

```
BasedOnStyle: llvm

AccessModifierOffset: -4
AlignConsecutiveBitFields: Consecutive
AlignEscapedNewlines: Right
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Custom
BreakConstructorInitializers: BeforeComma
BraceWrapping:
 BeforeElse: true
  BeforeCatch: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
IndentWidth: 4
NamespaceIndentation: None
PenaltyBreakAssignment: 60
PenaltyBreakBeforeFirstCallParameter: 175
PointerAlignment: Left
QualifierAlignment: Custom
QualifierOrder: ['static', 'inline', 'constexpr', 'type', 'const', 'volatile']
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpacesBeforeTrailingComments: 2
SpacesInSquareBrackets: false
```

ends up formatting as:

```cpp
template <typename AAA,
          typename BBB,
 typename CCC,
          template <typename>
          class DDD>
class SomeTemplate;
```

Notably with `DDD` split in two lines, instead of `template <typename> class DDD`. This is a confusing formatting choice since `class DDD` is a valid template parameter in its own right, and it's very easy to miss the leading *template-head* here. 

If I set `BinPackParameters` to `true`, then I get:

```cpp
template <typename AAA, typename BBB, typename CCC,
 template <typename> class DDD>
class SomeTemplate;
```

This formats `DDD` the right way, but also packs the other parameters - which I wanted to avoid. 

Is there a way to format `SomeTemplate` this way?

```cpp
template <typename AAA,
 typename BBB,
          typename CCC,
          template <typename> class DDD>
class SomeTemplate;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VlFz4jYQ_jXmRQNjZALhgQcwYYbpNaTlOve8yGt7G1lyJRmO-_UdyTg4kGunvblMJhlL3-5-_vTtymAtFQpxET2soof1ABpXarM4GDx-IzU46Oy8-FySZUKCtcxhVUtwGCXLKF5Hcfd3Gre_oq7blQ7IoiR15xoVVMiWy2XEU_b2vFqt3j2naRqeP4iNkqcLhfV6HSVPbZV2Za8r_PxGbHVDqc_zRK5kzr9ONI1HQoIqhrk2Fbgb4E30CixmO7V3Z-lfnUl5rPrwpRBo7a86o5zQ7PLcovO44eSyL6lQqVYWRePoiCtyG0KZWQ_qrffQT1ZAjdkzniQpDMDfqShdB5H6tJTyBQxU6NDYXb5GIcGAI6126hm_uk-kAtscpMVe3L7Uxq2kFq92p5Z7UoXEf8RuGiV82nu4M80b-gRnuzIIr91Z9AjZ9-AVqRcQr0tTNBUqZ28qX7avL3e776usMNcGVwZEq07aWKerHsDr6kwjnDZbRY5A0rdLrjY21VUFXQAI_GKgrkkVb-a-4J584Xf8WZcBnCjfb6VaNpX6RBUFBzzG3fJHZJZS7tROBTl3ZqfwBc29tFuVoXJfKHOh1sVTz1ChrUFgux1k9tvPWl3iXlCBdOcgxjL0uRfbYzpf9xHtG23IWJdCz1keP549XAI0Ked595J9wvziyt8akKED3u33D-YNsTNZm9rPHT6znr-I-Mz3f8RnpLzrr8_Cy4dfa3Nd8pPhBnB9PGoJjmQAPKzb2ntt3FYJ2WR4Y0e_84clVXzfsXuv9DJ3aNIwBVKw7nuIzv-_4PmkTfYBzLZifzZAklThjdi1Ae_Dtmr_VwOty1_xrk8-nHGoMsuamrVzzZEqGNgfmded5bufm_F92b4Z4ndBH8_0W9iPj_hn7eAgzyyM-mga-1zTmNl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