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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] return type can be split on namespace when member template has comment
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

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

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

<pre>
    clang-format version 20.1.0 (https://github.com/llvm/llvm-project.git https://github.com/llvm/llvm-project/commit/24a30daaa559829ad079f2ff7f73eb4e18095f88) formatted code like this:
```
// ---
// IndentWidth:     4
// PenaltyReturnTypeOnItsOwnLine: 800

class MyClass {
    template <bool abool, // a comment
              bool anotherbool>
    static inline std::pair<size_t, MyCustomTypeeeeeeeee>
 myfunccccccccccccccccccccccc(const char *buf, const char *&err);
};
```
whereas clang-format version 21.1.0-rc3 (https://github.com/llvm/llvm-project.git https://github.com/llvm/llvm-project/commit/6096d35ea93c75f648a253a00775b4d74915c819) splits the `std::` from the rest of the return type:
```
// ---
// IndentWidth:     4
// PenaltyReturnTypeOnItsOwnLine: 800

class MyClass {
    template <bool abool, // a comment
              bool anotherbool>
 static inline std::
        pair<size_t, MyCustomTypeeeeeeeee> myfunccccccccccccccccccccccc(
            const char *buf, const char *&err);
};
```
i could see this being "as designed," but what's odd is that if the comment in the member template is removed, the formatting 21.1.0-rc3 does changes back to how clang version 20.1.0 did it:
```
// ---
// IndentWidth:     4
// PenaltyReturnTypeOnItsOwnLine: 800

class MyClass {
    template <bool abool, bool anotherbool>
    static inline std::pair<size_t, MyCustomTypeeeeeeeee>
 myfunccccccccccccccccccccccc(const char *buf, const char *&err);
};
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcVV-r2zYU_zTKyyFBObL858EPae4uFFY6xmCPQ5aOY_XaUpDkG7JPP-S4S9p1bIUxth6MJVnnv3_6ScVoT46oZfINk08bNafBh_aDp3Hw-mXTeXNt9ajcadv7MKkErxSi9Q6Q7_Y7DgzrIaVzZOLA8Jnh88mmYe522k8Mn8fx9eOwPQf_gXTanWyCrzNh-Kz9NNk8wUIJbpRSUjY1Nsrwqumx76u-EtQVtK95I_u6ZtjALeNEBrQ3BKN9IUiDXQLzAyv5-vA1D9hut_fFW2fIpZ-tSQMTB8hS3Hd_IKfGdP2R0hzcT9czvXdvU3x_cd9bR1m_5otjftCjihHeXY_LyKo3jC_eEk3nUSUCJo6d9yOo_GZ4hDWEglw1ubQa3OWm7nwaKCxG4rtVJyaVrAbrRusIYjK5VnE4KxuYOEb7K_2Scoh31-Mck59y5h9l9TJd-9npLwvDWnsXE-hBBWB46OY-u_v0I8OSQmDYMJGLZdXTOnno-GWgQCrCl7G1z9jaBi3-dXyVvCmNkKQaoSvZl0WtUArFeVXJrjBV0eylrvdNxlc8jzZFSAMBK_nvzWYlhz74adkIFBP4fp1nsEC6nulbheCf4O_B_O9C8a9w-FlG_xAsLWg_jwYi3agCOrLuBAxRRTC0kKVheGSI0M0JLoNKDKsI3hiwGQsqgb397rV1YN2ynGjqKNx7biMEmvzr4m_RWPkqB3w4AcZTzDW4E0XolH6B5GHwl9vR-ZyPjTVg038dXv93AtuYVphGNGpD7b6SEpuqQLEZ2kqg5FJ20oiOSlUVaOqKOlWopujLstrYFjlKXu8loqi42HW6k6Xu0NR1bUosWcFpUnbcZYba-XDa2BhnavdS1M1-M6qOxrhc14iP5MkQ8wUe2oXZuvkUWcFHG1O8e0o2jctV_4mhfHpkJtDKQUc3cgPvwKmJ4llpgstA7g8wHjKJ35C-mcPYfjX1LuVFhs9rha8t_hYAAP__yumrXw">