[clang] Fix false match on nullPointerConstant for array indices (PR #201893)
Kay Hicketts via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 26 02:16:29 PDT 2026
================
@@ -4049,6 +4049,7 @@ TEST_P(ASTMatchersTest, NullPointerConstant) {
EXPECT_TRUE(matches("char *cp = (char *)0;", expr(nullPointerConstant())));
EXPECT_TRUE(matches("int *ip = 0;", expr(nullPointerConstant())));
EXPECT_FALSE(matches("int i = 0;", expr(nullPointerConstant())));
+ EXPECT_FALSE(matches("int *p[1]; (void)p[0];", expr(nullPointerConstant())));
----------------
KHicketts wrote:
that's super weird. I didn't know you could do that 👀
https://github.com/llvm/llvm-project/pull/201893
More information about the cfe-commits
mailing list