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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] false negative for misc-const-correctness in function-try-block
        </td>
    </tr>

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

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

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

<pre>
    The check `misc-const-correctness` of clang-tidy 19.0.0git (20d38158ffbe1e01b74e39d36d4b3bc5e7a63d66) does not work as expected for function-try-blocks.


For thee following function the warning warning `variable 'i' of type 'int' can be declared 'const' [misc-const-correctness]` is generated.
```
int tp() {
  try {
 int i = 0;
    return i;
  } catch (...) {
    return 0;
 }
}
```
When the outer curly braces are ommited, the check does not report a warning.
```
int fn() try {
  int i = 0;
  return i;
} catch (...) {
  return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU01v6yoQ_TV4M4qFwZ8LL9oX5Rc86a0xjG1eCEQwTm_-_ZWdNE1vW13JMp7DzHjOgaNSspNH7Fn1yqp9phaaQ-yTntEfMWZDMNf-3xlBz6iPwGp-sknvdPCJdjrEiJo8psRqDmEE7ZSfdmTNFYou5zmfLAETreBGtkXVjuOABfJiaEqUnZG1KQc56AobVUtT10x0YAIm8IHgLcQjqAT464ya0MAYIoyL12SD31G87gYX9DHljO8Zf3l-H0IEmhFhDM6FN-unR-GKw5uKfgXfV1bzi4pWDQ6BicYy0ax06Hq-xZ5WRCsPA4JB7VREs-5sQqx7rHr9QZlqv4pjE0zoMSpC8z5wze_PFlpPQGcm2lUE1rzeUACK16dwzbLA5B44k48cgIi0RA_2CWTNHrQiPa8nkOf5H30fNU-NWLO_z_b4-DzkfzPeFAwLYQS9RHeFISqNCVRECKeTJTRM_LNl3W7N40QjnkMkUO-6_yzE6O9CfGb_A_0v5P9C_Qvxr3Qz00vTyU5l2BeNKOqylKLO5r5C1XaCD0a3aBpRyLbhpi0bM2BVdE2T2V5wUfJGiIJLwetctrxqseXtqHSp5chKjidlXe7c5ZSHOGU2pQX7rmtrnjk1oEubH4X48BMTYvVn7Nei3bBMiZXc2UTpow1ZcpuTn8qqPYzKJQSPkyJ7wc1F319VsP4bf2VLdP1MdE5MvjBxYOIwWZqXIdfhxMRh_f192Z1j-B81MXHYKCUmDjdWl178DgAA__-8c1NH">