llvm-project
3ade8746 - [clang] Look through parens around reinterpret_cast to emit a warning (#157033)

Commit
154 days ago
[clang] Look through parens around reinterpret_cast to emit a warning (#157033) Clang warns about UB when a `reinterpret_cast` is dereferenced as an incompatible type: ``` long l; *reinterpret_cast<double*>(&l) // UB ``` However, the code was too strict and did not handle extra parens around a `reinterpret_cast`, so the following case was not diagnosed: ``` long l; *(reinterpret_cast<double*>(&l)) // UB, but no warning ``` The patch now skips ParenExpr when looking for a CXXReinterpretCastExpr to enable a diagnostic for the second case.
Author
Parents
Loading