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

    <tr>
        <th>Summary</th>
        <td>
            clang-format: `AlignTrailingComments: Kind: Leave` not applicable in this scenario?
        </td>
    </tr>

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

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

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

<pre>
    
With clang-format 17.0.3 and [these](https://github.com/llvm/llvm-project/files/14588232/clang-format.txt) clang-format settings, I'd hope the following code to be formatted pretty much as is -
```cpp
enum class Thing
{
        Banana,
        Cat,
        Shoe,
        Biscuit,
};
Thing things[2][3] = {
        { //[0][...]
                Thing::Banana, //0
                Thing::Cat,  //1
                Thing::Shoe,  //2
        },
        { //[1][...]
                Thing::Cat,  //0
                Thing::Shoe, //1
                Thing::Biscuit,  //2
        }
};
```

However, applying the settings above, I get the less desireable -
```cpp
...
Thing things[2][3] = {
        {
  //[0][...]
                Thing::Banana, //0
                Thing::Cat,  //1
                Thing::Shoe,  //2
        },
        {
 //[1][...]
                Thing::Cat,  //0
                Thing::Shoe, //1
                Thing::Biscuit,  //2
        }
};
```

I.e. the line break after the array initialiser's inner opening brace/`{`, and before the trailing comment on the same line.

I don't claim I understand the combination of all potentially applicable rules in this scenario well enough to suggest this is a bug.  I think it's more likely either I can't get the result I expect or I'm just missing a key setting that I'm not aware of, however, I would have hoped that `AlignTrailingComments: Kind: Leave` would be the main factor in retaining the trailing line comments, immediately after each inner array opening brace/`{`.

Is there a way (without `//clang-format off`) to get clang-format to accept/keep the trailing comments on the same lines as the array initializer opening brace (`{ //[0][...]`), as shown in the first code block?  If so, what other setting is introducing this unwanted break (and weird 2-space indentation) and what settings are needed to achieve this formatting?

Or should `AlignTrailingComments: Kind: Leave` be ultimately responsible for doing what I'd like/expect and does the presence of the inserted line break suggest this might be a bug?

Or is the kind of formatting in the first code block not actually achievable through clang-format's current set of rules and would it be feasible to support this style?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVk9v47YT_TT0ZRBBpmzLPvgQx_DvZ7RAC3SBnilxJHFNkQJJxet--mJIObE366LpbYEg1p8R582bN48U3qvWIG7ZcseW-5kYQ2fd9n_owuX3WWXlZcvyPcuf_1Shg1oL0z411vUiwLzM8qwAYSSw5S506JEt94yvuxAGz4pnxg-MH1oVurHKatszftD69frzNDj7FevA-KFRGj3jh_liuV7zgjN-uM2UhW-B8c19do8hKNN6xl_gyHgpobMDQugQGqu1PSvTQm0lQrBQ0UP6LKCEwWEIF-jHugPhQXl4SiWyVZ7-6mFIT9CMPaX1Hr50yrRTXLmbLvLNThhhBOMvb09eRLi9_aOzeHu_U74e1U1IuWfFtF7MAaGLdS13nOhc7gq23AMr9nCbl5U7SPyy5S5PgVmW0cVbSL5JoItnVjy_AZ0-yx_EJfgwRc0fRE1VXcP4Da79bbV3MOf_AuZ9-kcgr-n_GeQ71T_G-YH_NwFcw-j__-0ZX9HRKmIY9CW1CN8ECKKyrxHNEVoM8Z1G70GiVw5FpfGxwIiL_9D6dA0_iQImtD-5Do4ZZqm5yiBUDsUJRBPQxYfCOXEBZVRQQitPeik9KGPQgR3QUHcrJ2okAKucWFnlUVNGQoWNdcm7ghNKJ-vqezQBrElqE33KnN1hAmkN42Ugk1I9HGE0Ep0PtCp9Vtu-UkYEZQ3YBoTWMNiAhlDqSxS0qqNE3aiRAJMGPfgajXDKwhm1BjR2bDsyUj-2LfqQgpQHAdXYZgDHKN0TEMulh57K0eqE-gKoQocOjlCLBPU6JA79qAMcAb8NWAewLhp5D19HH6BX3hMPAk54uQ4bhE6EKcrYAOIsHIJtiMjufU6PcLajltCJV4zbgkwfslX-rFVrvkwkvySOaa-CX5SR9Psrildkq3xaokpt6YUy0Ig6WEccOQxCmasTvPUsKqO-LspfQPU9SiUC8ZC0gqLuJlkkyTwUx32j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