AaronBallman wrote:
> This started to cause
>
> ```
> $ cat test.c
> #include <string.h>
> void f(void) {
> char a[strlen("x")];
> (void) a;
> }
> ```
>
> ```
> $ clang -Wall -fsyntax-only test.c
> test.c:3:12: warning: variable length array folded to constant array as an
> extension [-Wgnu-folding-constant]
> 3 | char a[strlen("x")];
> | ^~~~~~~~~~~
> 1 warning generated.
> ```
>
> to emit a warning, and I'm not sure that's intentional?
That is intentional; `strlen` is not a valid constant expression in C, and so
that is technically a VLA, except we have an extension to fold it back into a
constant.
https://github.com/llvm/llvm-project/pull/70307
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits