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

    <tr>
        <th>Summary</th>
        <td>
            clang-format - odd wrapping with pure virtual methods with several arguments on more lines
        </td>
    </tr>

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

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

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

<pre>
    I'm involved in reformatting a larger project using clang-format, and we stumbled across this odd behavior when using clang-format version 15 and 16.  With clang-format version 14 and 13 the behavior is mixed.

The `.clang-format` config:
```
BasedOnStyle: Microsoft
ColumnLimit: 0
SortIncludes: Never
BreakBeforeBinaryOperators: All
BinPackArguments: False
BinPackParameters: False
LambdaBodyIndentation: OuterScope
```

Input source code:
```c++
class AnObject
{
    virtual a_method_no_wrap(std::string &text) = 0;

    virtual a_method_no_wrap_2(std::string &text, std::string text) = 0;

    // Wrong wrapping!
    virtual a_method_no_wrap_3(std::string &text,
                               std::string text) = 0;

    virtual a_method_no_wrap_const_1(std::string &text) = 0;

    virtual a_method_no_wrap_const_2(std::string &text, std::string text) const = 0;

    // Wrong wrapping!
    virtual a_method_no_wrap_const_3(std::string &text,
                                     std::string text) const = 0;
}
```

With clang-format-15 and newer we get this:
```diff
@@ -8,7 +8,8 @@
 
     // Wrong wrapping!
     virtual a_method_no_wrap_3(std::string &text,
-                               std::string text) = 0;
+                               std::string text)
+        = 0;
 
     virtual a_method_no_wrap_const_1(std::string &text) = 0;
 
@@ -16,5 +17,6 @@
 
     // Wrong wrapping!
     virtual a_method_no_wrap_const_3(std::string &text,
-                                     std::string text) const = 0;
+                                     std::string text) const
+        = 0;
 }
```

With clang-format-14 and clang-format-13 we get this:
```diff
@@ -8,7 +8,8 @@
 
     // Wrong wrapping!
     virtual a_method_no_wrap_3(std::string &text,
-                               std::string text) = 0;
+                               std::string text)
+        = 0;
 
     virtual a_method_no_wrap_const_1(std::string &text) = 0;
 
```

We would not expect the the ` = 0;` part to be moved to a separate line.  So far we have not been able to identify a configuration knob avoiding this behavior.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVsFu2zgQ_Rr5MrBhSbFsHXSwEwQI0G4KZIEeA0ocyWwoUiApO_n7HVLKpm5SO3VT7GUNwaY4M4_DN0P6lZo_FTdRsmxBqJ2WO-Q0AIO1Ni1zTqgGGEhmGjTQGf0NKwe99dOVZKqZDn5RcglMcdgjWNe3pSQYVhltLbitsKA5hxK3bCe0gf0W1RsYsENjhVYQLwJWnM0Avgq3_YnXxeCV0gr4Ak6LteIR-SyaX0Xz9fD9N3lE2Xx2kHI2h0qrWjRROrrR1PiE1w2zyG_VnXuSSD7wWfgd6doN5kst-1Z9Eq1w3joG3WnjblQle47WT_-FlPCIZ5A9bDyzuBGKmafbDg1z2gTHtZSjm1BfWPWwNk3fonLBeM2kxQPzF2ZYiw7Nj_ZPrC0521BdbxSneOaILe9z25P3XaU7fHO3w_eN6noHVvemQqKH42tyqijZ-CfMEqNU47W6LX1njJ7L0Qj02QnjeiaB3VO2W83vlb7fG9ZFyco67tHTtXXGN0OUZA4fqZdyiNIrIjTdfJ_aMbT75BjeJfxoOrVOlFzTA1-NJme_QEdRURK_I5P0aCYvAEc-v5rtT3Oh_rbuPv5grgfUMxkPwX-C9yGrD2D_eA3ezH95deRIvbrCpuMFp3BPlypdmQ26cE2-Pmtc1PU4dTGnB6Yr2saStrTxgxUM0-O-vtveaSJ_r4OnH9PCyeY8nFfhh7jwnm2ecTjgsBZxRnwsfDHiJY2yP1KN9_f1qZqc0dgn6_MOzJO1-tXTM_zxH86l_5-jc3D-43P0ZsER9rqXdD1qB_jYecHpFZ4bNNwLEo07ZsioSf1Bq710pTEDizTPHIIUCklD3mmoWbhoSSNiwC2RJCgjmeojhJdJon6i0EEQ9iaIJnhQugS204IHyryQfdaZswkWcZYlaZ7HSTzhRcrzNGc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