2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/span (span(T (&)[N])): Use non-deduced context to
+ prevent first parameter from interfering with class template argument
+ deduction (LWG 3369).
+ * testsuite/23_containers/span/deduction.cc: Add missing 'const'.
+ * testsuite/23_containers/span/lwg3255.cc: Check for construction from
+ rvalues.
+
* include/std/span (span::const_iterator, span::const_reverse_iterator)
(span::cbegin(), span::cend(), span::crbegin(), span::crend()):
Remove (LWG 3320).
}
}
- template<typename _Tp, size_t _ArrayExtent>
- requires __is_compatible_array<_Tp, _ArrayExtent>::value
+ template<size_t _ArrayExtent>
+ requires (_Extent == dynamic_extent || _ArrayExtent == _Extent)
constexpr
- span(_Tp (&__arr)[_ArrayExtent]) noexcept
+ span(type_identity_t<element_type> (&__arr)[_ArrayExtent]) noexcept
: span(static_cast<pointer>(__arr), _ArrayExtent)
{ }
std::span s9(s2);
static_assert( is_static_span<int, 2>(s9) );
- std::span s10(const_cast<std::span<int, 2>&>(s2));
+ std::span s10(const_cast<const std::span<int, 2>&>(s2));
static_assert( is_static_span<int, 2>(s10) );
std::span s11(s5);
static_assert( is_constructible_v<span<int>, int(&)[2]> );
static_assert( is_constructible_v<span<const int>, int(&)[2]> );
static_assert( is_constructible_v<span<const int>, const int(&)[2]> );
+static_assert( is_constructible_v<span<const int>, int[2]> );
+static_assert( is_constructible_v<span<const int>, const int[2]> );
static_assert( is_constructible_v<span<int>, array<int, 2>&> );
static_assert( is_constructible_v<span<const int>, array<int, 2>&> );
static_assert( is_constructible_v<span<const int>, array<const int, 2>&> );
+static_assert( is_constructible_v<span<const int>, array<int, 2>> );
+static_assert( is_constructible_v<span<const int>, array<const int, 2>> );
static_assert( is_constructible_v<span<const int>, const array<int, 2>&> );
static_assert( is_constructible_v<span<const int>, const array<const int, 2>&> );