From 66ae31eb308e5bc90ce6dfd0a67381a0929a6aa0 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 19 Feb 2020 14:41:46 +0000 Subject: libstdc++: span's deduction-guide for built-in arrays doesn't work (LWG 3369) The 23_containers/span/deduction.cc test was already passing, but only because I had previously implemented the original proposed resolution of 3255. As pointed out in 3255 that original P/R was incorrect because it broke construction from array xvalues. This reverts the incorrect part of 3255 (and adds tests for the case it broke), and implements the resolution of 3369 instead. * 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. --- libstdc++-v3/include/std/span | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libstdc++-v3/include/std') diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span index ccfd7db..16b09a1 100644 --- a/libstdc++-v3/include/std/span +++ b/libstdc++-v3/include/std/span @@ -182,10 +182,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } - template - requires __is_compatible_array<_Tp, _ArrayExtent>::value + template + requires (_Extent == dynamic_extent || _ArrayExtent == _Extent) constexpr - span(_Tp (&__arr)[_ArrayExtent]) noexcept + span(type_identity_t (&__arr)[_ArrayExtent]) noexcept : span(static_cast(__arr), _ArrayExtent) { } -- cgit v1.1