[libcxx-commits] [libcxx] 0412c00 - [libc++] Implement LWG3369, tweak CTAD for std::span.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 29 13:15:52 PDT 2021


Author: Arthur O'Dwyer
Date: 2021-10-29T14:15:41-06:00
New Revision: 0412c007e3c2ec2687856923b3ac6e581ff4fbd8

URL: https://github.com/llvm/llvm-project/commit/0412c007e3c2ec2687856923b3ac6e581ff4fbd8
DIFF: https://github.com/llvm/llvm-project/commit/0412c007e3c2ec2687856923b3ac6e581ff4fbd8.diff

LOG: [libc++] Implement LWG3369, tweak CTAD for std::span.

The original bug doesn't reproduce on Clang, allegedly because of
https://bugs.llvm.org/show_bug.cgi?id=44484
We already test STL's exact test case, in "span.cons/deduct.pass.cpp",
which I'm touching just for the heck of it.

Differential Revision: https://reviews.llvm.org/D111838

Added: 
    

Modified: 
    libcxx/docs/Status/Cxx20Issues.csv
    libcxx/include/span
    libcxx/test/std/containers/views/span.cons/deduct.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/Cxx20Issues.csv b/libcxx/docs/Status/Cxx20Issues.csv
index 7be5bffbcc1a5..9b1de2cf2d5a2 100644
--- a/libcxx/docs/Status/Cxx20Issues.csv
+++ b/libcxx/docs/Status/Cxx20Issues.csv
@@ -274,7 +274,7 @@
 "`3363 <https://wg21.link/LWG3363>`__","``drop_while_view``\  should opt-out of ``sized_range``\ ","Prague","","","|ranges|"
 "`3364 <https://wg21.link/LWG3364>`__","Initialize data members of ranges and their iterators","Prague","","","|ranges|"
 "`3367 <https://wg21.link/LWG3367>`__","Integer-class conversions should not throw","Prague","",""
-"`3369 <https://wg21.link/LWG3369>`__","``span``\ 's deduction-guide for built-in arrays doesn't work","Prague","",""
+"`3369 <https://wg21.link/LWG3369>`__","``span``\ 's deduction-guide for built-in arrays doesn't work","Prague","|Complete|","14.0"
 "`3371 <https://wg21.link/LWG3371>`__","``visit_format_arg``\  and ``make_format_args``\  are not hidden friends","Prague","|Complete|","14.0","|format|"
 "`3372 <https://wg21.link/LWG3372>`__","``vformat_to``\  should not try to deduce ``Out``\  twice","Prague","","","|format|"
 "`3373 <https://wg21.link/LWG3373>`__","``{to,from}_chars_result``\  and ``format_to_n_result``\  need the  ""we really mean what we say"" wording","Prague","","","|format|"

diff  --git a/libcxx/include/span b/libcxx/include/span
index 29f833f6022d7..d41678d039404 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -61,7 +61,7 @@ public:
     template <class It, class End>
     constexpr explicit(Extent != dynamic_extent) span(It first, End last);
     template <size_t N>
-        constexpr span(element_type (&arr)[N]) noexcept;
+        constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
     template <size_t N>
         constexpr span(array<value_type, N>& arr) noexcept;
     template <size_t N>
@@ -236,7 +236,7 @@ public:
     }
 #endif
 
-    _LIBCPP_INLINE_VISIBILITY constexpr span(element_type (&__arr)[_Extent])          noexcept : __data{__arr} {}
+    _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data{__arr} {}
 
     template <class _OtherElementType,
               enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr>
@@ -422,7 +422,7 @@ public:
 
     template <size_t _Sz>
     _LIBCPP_INLINE_VISIBILITY
-    constexpr span(element_type (&__arr)[_Sz])          noexcept : __data{__arr}, __size{_Sz} {}
+    constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
 
     template <class _OtherElementType, size_t _Sz,
               enable_if_t<is_convertible_v<_OtherElementType(*)[], element_type (*)[]>, nullptr_t> = nullptr>

diff  --git a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp b/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
index 55ed727ef4902..702ec487b0f18 100644
--- a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
@@ -6,11 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: libcpp-no-concepts
 // UNSUPPORTED: libcpp-has-no-incomplete-ranges
 
-// AppleClang 12.0.0 doesn't fully support ranges/concepts
-// XFAIL: apple-clang-12.0.0
-
 // <span>
 
 //   template<class It, class EndOrSize>


        


More information about the libcxx-commits mailing list