Issue 115175
Summary [clang-tidy] bugprone-sizeof-_expression_ false positives
Labels clang-tidy
Assignees
Reporter namniav
    ```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
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to