[all-commits] [llvm/llvm-project] 191386: [C23][Parser] Diagnostic for attribute declaration...
yronglin via All-commits
all-commits at lists.llvm.org
Tue Jul 8 17:54:53 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 191386fcd3335c5b7194da209d71d16549a2bb2f
https://github.com/llvm/llvm-project/commit/191386fcd3335c5b7194da209d71d16549a2bb2f
Author: yronglin <yronglin777 at gmail.com>
Date: 2025-07-09 (Wed, 09 Jul 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticParseKinds.td
M clang/lib/Parse/ParseStmt.cpp
M clang/test/Parser/statements.c
M clang/test/Sema/c2x-fallthrough.c
Log Message:
-----------
[C23][Parser] Diagnostic for attribute declaration where statement is required (#146224)
Fixes: https://github.com/llvm/llvm-project/issues/141659
In C23, something like [[/*possible attributes*/]]; is an attribute
declaration, not a statement. So it is not allowed by the syntax in
places where a statement is required, specifically as the secondary
block of a selection or iteration statement.
Therefore, code like the following should give a diagnostic (at least
with -std=c23 -pedantic), but Clang currently does not produce one:
```cpp
int main(void) {
if (1)
[[]];
}
```
---------
Signed-off-by: yronglin <yronglin777 at gmail.com>
Signed-off-by: Wang, Yihan <yronglin777 at gmail.com>
Co-authored-by: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list