[clang] [clang][Sema] Don't report pointer subtraction on a VLA as zero size (PR #217465)
Aditya Medhane via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 30 11:06:00 PDT 2026
================
@@ -416,6 +416,11 @@ features cannot lower the translation-unit ABI level;
- `-Wc++98-compat` now diagnoses explicit conversion functions in C++20 and
later, matching the behavior in C++11 through C++17. (#GH161689)
+- `-Wpointer-arith` no longer reports subtraction of pointers to a variably
+ modified type, such as `int[n]`, as a subtraction of pointers to a type of
+ zero size. The size of such a type is not known statically and is modelled as
+ zero, which is not the same as the type being empty. (#GH28328)
+
----------------
flash1729 wrote:
yeah, added a helper that walks the array dimensions and folds each variable bound as an ICE, so it only warns when the size really comes out to zero. struct Empty `vla[n]` and` int vla[n][0]` warn again now, both covered in empty1.c
https://github.com/llvm/llvm-project/pull/217465
More information about the cfe-commits
mailing list