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

    <tr>
        <th>Summary</th>
        <td>
            Clang 15: -Wunused-but-set-variable doesn't recognize pre- or post-increment as "use"
        </td>
    </tr>

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

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

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

<pre>
    This seems to be a Clang 15 regression; the provided example works in Clang 13 and 14.

This code snippet:
```
void foo() {
    int bar = 0;
    ++bar;
}
```

With these command line parameters:
`-Wunused-but-set-variable -Werror -c`

Results in this compilation error:
```
<source>:2:9: error: variable 'bar' set but not used [-Werror,-Wunused-but-set-variable]
    int bar = 0;
        ^
```

Compiler explorer link:
https://godbolt.org/z/dKW5qhroz

The same issue occurs if you write `bar++` instead of `++bar`. It goes away if you write `bar = bar + 1`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVE2PmzAQ_TXmMiICQyAcODTJVqp6qyrlbPBA3DU2tU3S3V_fwdmPdrVbNbKNzcSe994801n50H4_Kw8ecfIQLHQIAg5amBHyLTgcHXqvrGHFHsIZYXb2oiRKwF9imjXC1bp7D8o8bypAGAl5uWHZkWWfbmPM0VuJ4I2aZwyseIqwKntqcXmxSsJgLeM7xhtg9f72HuinTIBOOGDFETLC8xphfE-NYi9vWX189_zbeFLhvLLxSKCmaQWslSFywokJAzr_J770tJjFo0y7JaQeQ3oRTomOuKcndM46SPs3Cb6hX3SIsoQb9WlWWgQSEuKWj_iz4uDt4npkxR39h1NvqL9sgpfcjNcrYV5T7UiXJYCxAVacwLb7J2SMHz5Ez7bH_9E26ru9-4eah0gOHVli1tbRhMS8f2F4DmGOevLP1EYrO6vDxrqRVo_U5dfT9ufZ2ce_DUNWoVqA8n5BsH2_OJJzgAe7wNWpQAJUWRRgLT3NiYIPKCTYYQ29WqLKNvAlwGjRg7iKh_dOibzjk-8hX7ck2OZVVWVlucvrRLaFbIpGJEEFje3z_VgL8rE7JGU0VKBA16i3o1GP6_XBFMgxs_UhVaZ3OCFJLzxl5nQMjcnidPtGNPLr0m3IRbTQ-vL8SOk2_sA-0DLq5Gmy3ZW8Ss5tn5fVUEnJd9nAh2JoaiHqig9N1nQd78pEiw61b8kslNTg9SY1zckYiWp5xnme5TWNRVFv-ozvim2FPJON2JWSlRlOQunNimOtZuLaCKlbRk9BrXzwr0FBH5HRIMZ0dL5Ywtm6FqWxpGUSU7cR-m8Cr2E1">