[clang] [Clang][C2y] Add support for if declarations (N3356 paper) (PR #198244)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 26 10:48:13 PDT 2026
================
@@ -55,7 +55,7 @@ bool negative_test_if() {
expected-error {{expected expression}}
expected-warning {{expression result unused}}*/
if (int x) {} // expected-error {{variable declaration in condition must have an initializer}}
- if ([[]]; true) {} // expected-warning {{empty declaration statement of 'if' has no effect}}
+ if ([[]]; true) {} // expected-error {{first clause in condition must be a declaration}}
----------------
Sirraide wrote:
I believe this should be valid because `[[]];` is a valid _attribute-declaration_, which is a _declaration_ in C (but not in C++...).
https://github.com/llvm/llvm-project/pull/198244
More information about the cfe-commits
mailing list