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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Unnamed class-template function parameters have unexpected behavior with `AlignAfterOpenBracket: BlockIndent`
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          mope-life
      </td>
    </tr>
</table>

<pre>
    When `AlignAfterOpenBracket` is set to `BlockIndent`, unnamed function parameters that themselves have template parameters are not formatted as expected. This problem manifests differently depending on whether the function has more than one parameter. This is a hard problem to describe in words, so please see the examples below. I included several cases in order to assist with debugging.

Here is my `.clang-format`:
```
Language: Cpp
BasedOnStyle: LLVM
AlignAfterOpenBracket: BlockIndent
```

`main.cxx` after formatting:
```cpp
template <class T> class TestClass {};

/* This declaration fits on one line: OK. */
template <class T> void shorter_function_name(TestClass<T>);

/* This declaration has block-indented parameters, as expected: OK. */
template <class T>
void really_long_function_name_________________________________________________(
 TestClass<T> a
);

/* This declaration has block-indented parameters, as expected: OK. */
template <class T>
void really_long_function_name_________________________________________________(
 int a, TestClass<T> b
);

/* This declaration has some line-breaks because it is longer than the column
 * limit, but they are not where expected. */
template <class T>
void
 really_long_function_name_________________________________________________(TestClass<
 T>);

/* This declaration doesn't have any line-breaks at all, despite being longer
 * than the column limit. */
template <class T>
void really_long_function_name_________________________________________________(int, TestClass<T>);

/* Placing the int parameter after the class-template parameter results in
 * correct behavior. */
template <class T>
void really_long_function_name_________________________________________________(
 TestClass<T>, int
);

int main() { return 0; }
```

`main.cxx` after formatting, but with `AlignAfterOpenBracket` set to any other option:
```cpp
template <class T> class TestClass {};

/* All declarations are formatted as expected. */

template <class T> void shorter_function_name(TestClass<T>);

template <class T>
void really_long_function_name_________________________________________________(
 TestClass<T> a);

template <class T>
void really_long_function_name_________________________________________________(
 int a, TestClass<T> b);

template <class T>
void really_long_function_name_________________________________________________(
 TestClass<T>);

template <class T>
void really_long_function_name_________________________________________________(
 int, TestClass<T>);

template <class T>
void really_long_function_name_________________________________________________(
 TestClass<T>, int);

int main() { return 0; }
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcV11z6jYQ_TXiZQfG2AbCAw9AmumdppPO9LZ9zKylxVYjSx5JJuHfd9YGQj6b3PZOmWYyiUGy9uzZo7MShqBLS7QQk5WYXA6wjZXzi9o1NDR6Q4PCqd3ij4osiGmyNLq0y00kf9OQXXmUdxTFNAEdIFCE6HjWyjh598Uqsjwm0jW01mJNCjatlVE7Cw16rCmSDxArjBArqgOZLQWocEsQqW4MRjqdiJ7Auggb52uMkRRgAHpoSEZSI_ha6QCNd4WhGmq0ekMhBlB6syFPNpodKGrIKm1LcBbuK4oVeQ79iKvCALXzxKgsOHsCYB9BB0Co0KtjrOhAUZBeFwTawr3zKnDSwUFjCANBIOrC0APWjaEABRl3P4IvoK00rSIFgbbk0YDEQIGXcV4xOAdcoRDhXscKFBVtWWpbjkRyKZJl__dH8sS46h2zP5IGbTnsWWL-s_00fu5_u4_XaMsWSxLZEtZN03-5wkDqxv4ad6YbuL7-_ed-5PXSZ0s4rfZrcY5f1qjtSD48sF6QFzpUUtvyJUh5gHSUgsjW0mAI8FVkP8D-kUJcd09ithKzS5GtnkRNr0S67AunSBr02JV5o2NgDXCBjbZdqjc_jUCk3Svvxd06rSBUzkfytwfd3LK8RXpxhCOyNc8W6fyDiFh4BTM51B2VpE6kz2o60frH0fZjHWRPaMzu1jhbPoV9-9kfkV7068LzdAEPSf6v09Y2AjK4F_kX35J_cHWvwmHhCe_YHSS2gUBH3tUMvbMptJ2JSGfa2u6h8KJG1zoynKLtjHR3dMr7ip3h0SI_w9w-wL_K3ylfBwl9apcoR8GKdBb7LoF294Q4jIDGMBWKQqMjQUHs9j2FJ5Q9I7On8L9UlrbxNUG9ycwvBiVnxjmwHI-bZu-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