[PATCH] D149000: Update with warning message for comparison to NULL pointer
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 24 13:32:55 PDT 2023
shafik added inline comments.
================
Comment at: clang/test/Sema/warn-tautological-compare.c:102
+}
\ No newline at end of file
----------------
Please add back the missing newline
================
Comment at: clang/test/SemaCXX/constant-expression-cxx2a.cpp:252
// ... but in the complete object, the same is not true, so the runtime fails.
- static_assert(dynamic_cast<const A*>(static_cast<const C2*>(&g)) == nullptr);
+ static_assert(dynamic_cast<const A*>(static_cast<const C2*>(&g)) == nullptr); // expected-warning {{comparison of address of 'g' equal to a null pointer is always false}}
----------------
I don't believe we should be emitting a diagnostic for this case. The `static_assert` passes. CC @aaron.ballman
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149000/new/
https://reviews.llvm.org/D149000
More information about the cfe-commits
mailing list