forked from OSchip/llvm-project
![]() Currently, Clang previously diagnosed this code by default: void f(int a[static 0]); saying that "static has no effect on zero-length arrays", which was accurate. However, static array extents require that the caller of the function pass a nonnull pointer to an array of *at least* that number of elements, but it can pass more (see C17 6.7.6.3p6). Given that we allow zero-sized arrays as a GNU extension and that it's valid to pass more elements than specified by the static array extent, we now support zero-sized static array extents with the usual semantics because it can be useful in cases like: void my_bzero(char p[static 0], int n); my_bzero(&c+1, 0); //ok my_bzero(t+k,n-k); //ok, pattern from actual code |
||
---|---|---|
.. | ||
clang | ||
clang-c | ||
CMakeLists.txt |