[clang] [clang][ExprConst] Check for array size of initlists (PR #138673)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Tue May 6 03:52:21 PDT 2025


tbaederr wrote:

That fixes compile-time computation, but this example still breaks in codegen:

```c++
#include <array>
using namespace std;
constexpr size_t kMemoryChunk = 1024 * 8;
constexpr size_t kNumberOfIterations = 2000000;
constexpr size_t kThreadsNumber = 2 * kMemoryChunk;
struct S {};

int main() {
    array<S, kThreadsNumber * kNumberOfIterations> futures{};
}
```
here: https://github.com/llvm/llvm-project/blob/dad316275689c8ff9b3051c98a842d0bb1226368/clang/lib/CodeGen/CGExprConstant.cpp#L1408-L1412

because `NumElements` is `32768000000`.


https://github.com/llvm/llvm-project/pull/138673


More information about the cfe-commits mailing list