[PATCH] D52841: [libcxx] Add missing static_assert error messages

Louis Dionne via Phabricator reviews at reviews.llvm.org
Wed Oct 3 14:38:06 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343725: [libc++][NFC] Add error messages to a couple of static_asserts in span (authored by ldionne, committed by ).
Herald added subscribers: llvm-commits, christof.

Changed prior to commit:
  https://reviews.llvm.org/D52841?vs=168154&id=168177#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52841

Files:
  libcxx/trunk/include/span


Index: libcxx/trunk/include/span
===================================================================
--- libcxx/trunk/include/span
+++ libcxx/trunk/include/span
@@ -242,7 +242,7 @@
         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,16 +440,16 @@
     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};
     }
 
     template <ptrdiff_t _Count>
     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};
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52841.168177.patch
Type: text/x-patch
Size: 1431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181003/813a00e1/attachment.bin>


More information about the libcxx-commits mailing list