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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The clang++ error on e is:
pr83993-2.C:5:22: error: constexpr variable 'e' must be initialized by a
constant expression
constexpr const int *e = &a[10];
                     ^   ~~~~~~
pr83993-2.C:5:27: note: indexing of array without known bound is not allowed in
a constant expression
constexpr const int *e = &a[10];
                          ^

Note, diag_array_subscript is called in constexpr.c multiple times, if we go
for allowing lval ary[0] for array of unknown bounds, but disallow ary[N] for N
!= 0 for lval or any N for !lval, we'd need 2 other diagnostic messages in
diag_array_subscript and handle these cases in the callers.
Another case that needs testing is const int array[0]; and [] arrays with
initializers from which the size is determined.

Reply via email to