[clang] Add thousands-separator to "cannot allocate array; evaluated array bound [...] exceeds the limit" diagnostic
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
E.g. for
```c++
constexpr int foo() {
auto p = new int[1'048'577];
delete[] p;
return 0;
}
static_assert(foo() == 0);
```
we emit
```console
a.cpp:10:15: error: static assertion expression is not an integral constant expression
10 | static_assert(foo() == 0);
| ^~~~~~~~~~
a.cpp:5:20: note: cannot allocate array; evaluated array bound 1048577 exceeds the limit (1048576); use '-fconstexpr-steps' to
increase this limit
5 | auto p = new int[1'048'577];
| ^
a.cpp:10:15: note: in call to 'foo()'
10 | static_assert(foo() == 0);
```
It would be nice to
1) Add thousands-separators to both the given size and the limit
2) Change the wording to "exceeds the limit of xyz" to avoid the parantheses.
Contributor guide
Research direction
Start by reproducing the diagnostic with the C++ example in the issue and locate the Clang code that emits the quoted array-bound message. Done means both the evaluated bound and its limit use thousands separators, and the wording changes to say "exceeds the limit of xyz" without parentheses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100