llvm / llvm/llvm-project

Declaration conditions that declare an array outside of the declarator are incorrectly rejected

Open
#182,724 1 comment 0 reactions 0 assignees View on GitHub
clang:frontend diverges-from:gcc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The following program demonstrates the issue:
```cpp
int main(){
typedef int T[];
if(T b={0});
}
```
Clang appears to interpret this as violating:
> The declarator shall not specify a function or an array.

Section 8.1 [stmt.pre] Paragraph 4 N5032

This program does not use the declarator to specify an array, instead it is specified in the decl-specifier-seq so it should be accepted as it is with GCC. See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124199

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.