https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97645

--- Comment #2 from Lénárd Szolnoki <leni536 at gmail dot com> ---
(In reply to Lénárd Szolnoki from comment #0)
> This was possibly impossible prior to C++20 to subscript an array of unknown
> bound in constexpr context. As of P0388 conversion from T[N] to T[] can
> happen in constexpr context.

A C++11 example:

```
extern const int arr[];
constexpr const int (&arrref)[] = arr;

constexpr int arr[2] = {1,2};

constexpr int x = arrref[0];
```

error: nonzero array subscript '0' is used with array of type 'const int []'
with unknown bounds

arrref[0] replaced with ((int*)arrref)[0] is accepted.

Reply via email to