[clang] Fix __builtin_object_size calculation for references of unknown origin in C++23 (PR #157778)

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 11 18:15:08 PDT 2025


ahatanak wrote:

> I'd also like to see some tests for potential constant expression checking (see #151053).

Something like this?

```
constexpr const int* add(const int &a) { return &a+3; }
constexpr int arr[4]{0, 1, 2, 3};
static_assert(__builtin_object_size(add(arr[0]), 0) == 4);
```

Could you elaborate on what kind of tests you have in mind?

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


More information about the cfe-commits mailing list