From 0e1a2a18ac7056e7fe3a033b664e6ecb8faba651 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 19 Mar 2026 20:02:09 +0100 Subject: c: fix qualifiers for array declarators `const int x[]` was being treated as `const int x[const]`, which is wrong, and matters when `x` is a function parameter that really decays to a pointer (`int const *const x`) --- test/17-misc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/17-misc.c b/test/17-misc.c index cec45b4..e6f9d11 100644 --- a/test/17-misc.c +++ b/test/17-misc.c @@ -52,6 +52,12 @@ struct S3 { char q; }; +int array_const_decay(const char x[3], int i) { + static const char y[3] = "11"; + if (!x) x = y; + return x[i]; +} + extern int printf(const char *, ...); #include #include -- cgit v1.2.3