| Issue |
184797
|
| Summary |
[request] Warn for integer-to-pointer cast with size mismatch
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
chrchr-github
|
~~~c++
#include <fstream>
#include <cstdint>
void f(std::ofstream& fout, std::uint32_t u) {
fout.write(reinterpret_cast<char*>(u), sizeof(u)); // cannot be a pointer
}
~~~
https://godbolt.org/z/EY85odK3E
Not sure if this should be a diagnostic or a clang-tidy check. `cppcoreguidelines-pro-type-reinterpret-cast` and `performance-no-int-to-ptr` seem too unspecific.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs