C23 restrict-on-array rejected (original) (raw)
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf page 120 (6.7.4 Type qualifiers, Constraints):
Types other than pointer types whose referenced type is an object type and (possibly multi-dimensional) array types with such pointer types as element type shall not be restrict-qualified.
Thus: int *
can be restricted, as can (int *)[10]
and (int *)[10][10]
.
Clang agrees with the former, and
works, but
typedef int *t[1]; restrict t x;
is rejected as
$ cc -std=c23 a.c -c
a.c:2:1: error: restrict requires a pointer or reference ('t' (aka 'int *[1]') is invalid)
2 | restrict t x;
| ^
Debian clang version 19.0.0 (++20240422112300+a2692ac23f14-1~exp1~20240422112407.665).