Issue 181730
Summary Missed -Wconstant-conversion warning in the case of plain C arrays
Labels new issue
Assignees
Reporter seanm
    Consider the following C:

```c
int main(void)
{
    signed char foo = 255; // does warn
    signed char bar[] = {255}; // does *not* warn

    return 0;
}
```

For `foo` we get a `-Wconstant-conversion` warning as expected:
```
warning: implicit conversion from 'int' to 'signed char' changes value from 255 to -1 [-Wconstant-conversion]
    3 |     signed char foo = 255; // does warn
 |                 ~~~   ^~~
```

But for `bar` we get no warning, which is a shame.

This is similar to https://github.com/llvm/llvm-project/issues/35534.

godbolt: https://godbolt.org/z/1r6Wh8EfP
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to