llvm-project
5b3ba261 - [Clang] [Sema] Allow non-local/non-variable declarations in for loop (#129737)

Commit
1 year ago
[Clang] [Sema] Allow non-local/non-variable declarations in for loop (#129737) Currently, we error on non-variable or non-local variable declarations in `for` loops such as `for (struct S {}; 0; ) {}`. However, this is valid in C23, so this patch changes the error to a compatibilty warning and also allows this as an extension in earlier language modes. This also matches GCC’s behaviour.
Author
Parents
Loading