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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] bugprone-sizeof-expression false positives
        </td>
    </tr>

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

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

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

<pre>
    ```c++
auto foo(auto t) {
  return sizeof(t.val) / sizeof(t.val[0]);
}
```

https://godbolt.org/z/4qa1odf5W

> ```c++
> <source>:2:24: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type [bugprone-sizeof-expression]
>     2 |   return sizeof(t.val) / sizeof(t.val[0]);
>       |          ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
> 1 warning generated.
> ```

> clang version 20.0.0git (https://github.com/llvm/llvm-project.git 4d374479bea4b33c5623ccfedc0870e396fc34cd)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-trunk-20241106/bin
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMFypDYQ_ZrmohpKaiGYOXDw7Jiq3FOVY0pADyirkYgkZu09-NtTwnjtOJtDKioBortf0-81ko7RTI6oBXUGdSn0mmYfWqdvzuh70fvxuYWav84B8JwnvwB_0Gvy7Oo94HFbJsATg2b3MhYorcGxaL6TvwIeU3nXdovB7rNVnTmoC-AJ5I6H5rIv3j6-v273OaUlgnwA7AC7yY-9t6n0YQLsvgN21Z9a-PGqfvsIAvnIfk5l88gv0a9hIJCPIB8wXxXIB_ZNB2fclJdxjYsZjF8jW6OeiPkrA2x-kCnLMnPA7h-WBuSZ9T7NjJ6WQDEa7yKb9Z1YmolFfSOWnhdioM79Oi3BOzq8Zjm8I7JGPwrOAxk0X9j_1nrPxvZs-3j5OBiox79bXl5e3uHiTSY2kaOgE43lT1T_3I7BajexO4XMjiEvecknkxjg8VOLTZrXvhz8DbCz9v72OCzB_0FDKjOqGmVTVc2pJ131Ug6qRjkMVxoHfmw4yVN9HWQ1jJn7VsKvOkyUcmefjvXvdXVY3Vfnv7mDNW59Okxu3ePmQHpkNz-SzdGLj-bp1fWLi0lbS-PFhOwC7PySALvB3xZjKeT2WR8oZFume0hhdV8PyLESgteAXW9cMbZyPMmTLqgVjeQn3qhGFHMr-pELce2pVkqNx5pzKUjrHutGiCM2hWnfMgklT5KXUqrjIHFoRlQCOUHF6aaNLbNeeY8UJsaVWiGUaFRhdU82btsfcS_QjM-AmI-D0G4q9-sUoeLWxBTf8yST7HZwfICpC_v3_5ddtY20yZfMnWKxBtv-t0YDdlv5EbDbGdxb_CsAAP__tiNvWw">