[clang] [clang] Look through parens around reinterpret_cast to emit a warning (PR #157033)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 5 00:54:00 PDT 2025
================
@@ -167,6 +167,9 @@ void dereference_reinterpret_cast() {
(void)reinterpret_cast<float&>(d); // expected-warning {{reinterpret_cast from 'double' to 'float &' has undefined behavior}}
(void)*reinterpret_cast<float*>(&d); // expected-warning {{dereference of type 'float *' that was reinterpret_cast from type 'double *' has undefined behavior}}
+ // Look through parens
+ (void)*(reinterpret_cast<double*>(&l)); // expected-warning {{dereference of type 'double *' that was reinterpret_cast from type 'long *' has undefined behavior}}
----------------
Fznamznon wrote:
Ah, we do, nvm.
https://github.com/llvm/llvm-project/pull/157033
More information about the cfe-commits
mailing list