[libcxx] r343725 - [libc++][NFC] Add error messages to a couple of static_asserts in span

Louis Dionne ldionne at apple.com
Wed Oct 3 14:36:16 PDT 2018


Author: ldionne
Date: Wed Oct  3 14:36:16 2018
New Revision: 343725

URL: http://llvm.org/viewvc/llvm-project?rev=343725&view=rev
Log:
[libc++][NFC] Add error messages to a couple of static_asserts in span

Summary:
Add error messages to a couple of static_asserts in span to match the
style used in the rest of the file. Also fix an extra paren typo in a
assert error message.

Committed on behalf of Jason Lovett.

Reviewers: ldionne

Subscribers: libcxx-commits

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

Modified:
    libcxx/trunk/include/span

Modified: libcxx/trunk/include/span
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/span?rev=343725&r1=343724&r2=343725&view=diff
==============================================================================
--- libcxx/trunk/include/span (original)
+++ libcxx/trunk/include/span Wed Oct  3 14:36:16 2018
@@ -242,7 +242,7 @@ public:
         constexpr span(      _Container& __c,
             enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
         : __data{_VSTD::data(__c)}
-        { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container))"); }
+        { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); }
 
     template <class _Container>
     inline _LIBCPP_INLINE_VISIBILITY
@@ -440,7 +440,7 @@ public:
     inline _LIBCPP_INLINE_VISIBILITY
         constexpr span<element_type, _Count> first() const noexcept
     {
-        static_assert(_Count >= 0);
+        static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
         _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
         return {data(), _Count};
     }
@@ -449,7 +449,7 @@ public:
     inline _LIBCPP_INLINE_VISIBILITY
         constexpr span<element_type, _Count> last() const noexcept
     {
-        static_assert(_Count >= 0);
+        static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
         _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
         return {data() + size() - _Count, _Count};
     }




More information about the libcxx-commits mailing list