https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110139
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC gives an error for the original testcase with -pedantic
In file included from arr.cc:1:
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array: In instantiation of
'constexpr std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::front()
[with _Tp = int; unsigned int _Nm = 0; reference = int&]':
arr.cc:2:21: required from here
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array:243:24: error: ambiguous
overload for 'operator[]' (operand types are 'std::__array_traits<int,
0>::_Type' and 'int')
243 | return _M_elems[0];
| ~~~~~~~~^
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array:243:24: note: candidate:
'operator[](int*, int)' (built-in)
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array:68:13: note: candidate: '_Tp&
std::__array_traits<_Tp, 0>::_Type::operator[](std::size_t) const [with _Tp =
int; std::size_t = unsigned int]'
68 | _Tp& operator[](size_t) const noexcept { __builtin_trap(); }
| ^~~~~~~~
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array: In instantiation of
'constexpr const std::array<_Tp, _Nm>::value_type& std::array<_Tp,
_Nm>::front() const [with _Tp = int; unsigned int _Nm = 0; const_reference =
const int&]':
arr.cc:2:21: required from here
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array:253:24: error: ambiguous
overload for 'operator[]' (operand types are 'const std::__array_traits<int,
0>::_Type' and 'int')
253 | return _M_elems[0];
| ~~~~~~~~^
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array:253:24: note: candidate:
'operator[](int*, int)' (built-in)
/home/jwakely/gcc/13.1.0/include/c++/13.1.0/array:68:13: note: candidate: '_Tp&
std::__array_traits<_Tp, 0>::_Type::operator[](std::size_t) const [with _Tp =
int; std::size_t = unsigned int]'
68 | _Tp& operator[](size_t) const noexcept { __builtin_trap(); }
| ^~~~~~~~