The _OIndexType template parameter will maybe deduced to reference, when
invoked from constructor and operator[]/at (after r16-7645-g66e60479e97640)
accepting array or span. We need to use forward for class-type and
remove_cvref_t for is_integral checks.
This resolves LWG4020: extents::index-cast weirdness.
libstdc++-v3/ChangeLog:
* include/std/mdspan (__mdspan::__index_type_cast): Handle
forwarding referene and use forward for class types.
* testsuite/23_containers/mdspan/int_like.h (ConstLValueInt)
(CustomIndexKind::ConstLValue): Define.
(CustomIndexType): Handle CustomIndexKind::ConstLValue.
* testsuite/23_containers/mdspan/at.cc: Test with ConstLValueInt.
* testsuite/23_containers/mdspan/extents/custom_integer.cc: Likewise.
* testsuite/23_containers/mdspan/mdspan.cc: Likewise.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>