llvm / llvm/llvm-project

Pre-C23 arrays of qualified type shouldn't be considered qualified

Open
#164,347 6 comments 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:
```c
int main(void){
const int(*p)[2]=0;
void*q=p;
}
```
Before C23, `const int[2]` was not considered a qualified type so this conversion was valid. GCC allows it, Clang incorrectly rejects it. Here is another example that demonstrates the opposite:
```c
int main(void){
int(*p)[2]=0;
const int(*q)[2]=p;
}
```
`const int[2]` is not a qualified version of `int[2]` before C23, so this conversion was invalid. GCC rejects it, Clang incorrectly allows it.

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.