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

    <tr>
        <th>Summary</th>
        <td>
            `initializer_list` suggested for removal with inline usage in range loop
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
#include <initializer_list>
#include <vector>

void f()
{
 std::vector<const char*> c1, c2;

    for (auto c : { c1, c2 }) {
 }
}
```

```
<source>:1:1: warning: included header initializer_list is not used directly [misc-include-cleaner]
    1 | #include <initializer_list>
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    2 | #include <vector>
1 warning generated.
```

https://godbolt.org/z/TMj55M6Pn

So if I remove the include as suggested and adjusted the code to not require `vector` it would no longer compile.

There is no warning when extracting the initializer list into a variable and using that.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVEuP2jAQ_jWTywiU2CQhhxx4LFIPK1Xq3itjD4lXxqZ-QHcP_e1VAiyIbqtaedjjmfF832dbhKA7S9RCuYRynYkUe-fbnfZ0EkfKtk69tVDl50ceDpCvIV8A49pKkxQh8JW2Omph9Dv570aHCPzpM7cjyej8bXL8Hp1WuAM2B9Zc7PXy3MEQFfAF8MU1ciWdDRFlLzywBfAnlAWwFUoGfHmfFRFx5zwCm4sUHUoEvkColx8BCPUaWIO31QbDpYBr54r7PvWjka-CS17SgIsvisuLJ-Gttt3QvVCgsCehyOMjXagDWhcxBVKotCcZzRtCudzrICeX6Ik0JCx5KNc3iAVCvcL_FAPHNgaUT7_-2m7O7JPsDxoWV5zYkSUvIqnpP7jrYzyEQVK2AbbpnNo6E6fOd8A278A2L8-vZflcfbX3Qd8c6h1-QU97dySMPV0ZRREwpK6jEEmhsAqFek3jYPCSThFGN3Lr6UfSnhCq_AKhylFHPLlkFFqHxtmOPEq3P2hD0_sCXnrydBbpA-6pJ4v0M3oh4zA-V_XBPJ51tdGhwKPwWmwNjRWmcHYXcZqplquGNyKjtqiavJzNm4ZnfSsUU7xoaFeIQlCjtjM2K5SqRVHvqnmRZ7plOeN5zeYFKyvOp3VZV5xzJfId5fMih1lOe6HN1JjjfiA40yEkaqtZ0cwzI7ZkwnjkGbN0wnESGBtuAN8OMZNt6gLM8gFHuGWJOhoa7oM_dlmV30kxHL1RLmHwpGOP2hptCVMQ3cATemE7QuPcIUvetA_7Qsc-bafS7YFthqUvv8nBu1eSEdhmLDgA24yAfgcAAP__wdx5Xw">