[clang] [Clang] Add '-Warray-compare' flag for C++ below version 20 (PR #118031)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 09:57:57 PST 2024
================
@@ -15,15 +15,15 @@ void test(const char *d) {
if (NULL == "/")
return;
if ("/" != DELIM) // expected-warning {{result of comparison against a string literal is unspecified (use an explicit string comparison function instead)}}
- return;
+ return; // cxx-warning at -1 {{comparison between two arrays}}
----------------
shafik wrote:
This seems to overlap w/ `warn_stringcompare` we probably want to do some special handling here since string literals are a special case of arrays and they have their own comparison functions.
We can do this as part of the C++26 feature implementation.
https://github.com/llvm/llvm-project/pull/118031
More information about the cfe-commits
mailing list