Fixes #18763 Remove warnings when using a signed char as an array bound if the char is a known positive constant. This goes one step farther than gcc does. For example given the following code ```c++ char upper[300]; int main() { upper['a'] = 'A'; char b = 'a'; upper[b] = 'A'; const char c = 'a'; upper[c] = 'A'; constexpr char d = 'a'; upper[d] = 'A'; char e = -1; upper[e] = 'A'; const char f = -1; upper[f] = 'A'; constexpr char g = -1; upper[g] = 'A'; return 1; } ``` clang currently gives warnings for all cases, while gcc gives warnings for all cases except for 'a' (https://godbolt.org/z/5ahjETTv3) With the change there is no longer any warning for 'a', 'c', or 'd'.
2.7 KiB
2.7 KiB