Skip to content

[clang] Add thousands-separator to "cannot allocate array; evaluated array bound [...] exceeds the limit" diagnostic #211770

Description

@tbaederr

E.g. for

constexpr int foo() {
  auto p = new int[1'048'577];
  delete[] p;
  return 0;
}
static_assert(foo() == 0);

we emit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contribute

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions