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

    <tr>
        <th>Summary</th>
        <td>
            Clang-format: wrapping function parameters fails when the last parameter is anonymous
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    If the last parameter in a longer-than-ColumnLimit function definition is anonymous (just the type defined), wrapping fails. Anonymous parameters work fine in other positions.

`.clang-format`:
```
BasedOnStyle: LLVM

AlignAfterOpenBracket: BlockIndent
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: false
```

Input:
```
bool FunctionDefinitionWithAnonymousLastParameter(const int &foo, bool deadbeef, const std::optional<std::vector<std::string>> &);
bool FunctionDefinitionWithAnonymousMiddleParameter(const int &foo, bool, const std::optional<std::vector<std::string>> &deadbef);
bool FunctionDefinitionWithOnlyNamedParameters(const int &foo, bool deadbeef, const std::optional<std::vector<std::string>> &bar);
```

Output:
```
bool FunctionDefinitionWithAnonymousLastParameter(const int &foo, bool deadbeef, const std::optional<std::vector<std::string>> &);
bool FunctionDefinitionWithAnonymousMiddleParameter(
    const int &foo,
    bool,
    const std::optional<std::vector<std::string>> &deadbef
);
bool FunctionDefinitionWithOnlyNamedParameters(
    const int &foo,
    bool deadbeef,
    const std::optional<std::vector<std::string>> &bar
);
```

Behaviour is identical with `Ubuntu clang-format version 14.0.0-1ubuntu1` and `clang-format version 15.0.0 (https://github.com/llvm/llvm-project.git 21eb1af469c3257606aec2270d544e0e8ecf77b2)`.

Obviously this isn't critical since it can be fixed by simply assigning a name to the last parameter.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlVcGOmzAQ_RpysYKMCZAcOCS7XWmltKlUtT3bMCTuGhvZJmn-vmOSTeg2lbbqq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