llvm-project/clang/test/SemaCXX/for-static-assert.cpp
Sirraide 50f0b30cff
[Clang] [Sema] Allow static assertions in the first part of a for loop in C (#134415)
No release note for this one because the one added by #129737 already
mentions ‘non-variable declarations’.

Fixes #56471.
2025-04-04 20:54:13 +02:00

8 lines
222 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
// C permits a 'static_assert' in the first part of a 'for' loop
// whereas C++ does not.
void f() {
for(static_assert(true);;) {} // expected-error {{expected expression}}
}