diff options
author | yronglin <yronglin777@gmail.com> | 2025-07-09 08:54:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-09 08:54:30 +0800 |
commit | 191386fcd3335c5b7194da209d71d16549a2bb2f (patch) | |
tree | dc9fe6e87ac5a386805a7ef747159fc0372f2d49 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 78039e12473fff3c655870c3bb369e6dd1b46444 (diff) | |
download | llvm-191386fcd3335c5b7194da209d71d16549a2bb2f.zip llvm-191386fcd3335c5b7194da209d71d16549a2bb2f.tar.gz llvm-191386fcd3335c5b7194da209d71d16549a2bb2f.tar.bz2 |
[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@gmail.com>
Signed-off-by: Wang, Yihan <yronglin777@gmail.com>
Co-authored-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions