[libcxx] r178064 - Another vector debug mode test, and a static test on Allocator::value_type. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=15576.

Matthieu Monrocq matthieu.monrocq at gmail.com
Tue Mar 26 12:30:27 PDT 2013


On Tue, Mar 26, 2013 at 8:04 PM, Howard Hinnant <hhinnant at apple.com> wrote:

> Author: hhinnant
> Date: Tue Mar 26 14:04:56 2013
> New Revision: 178064
>
> URL: http://llvm.org/viewvc/llvm-project?rev=178064&view=rev
> Log:
> Another vector debug mode test, and a static test on
> Allocator::value_type.  This partially addresses
> http://llvm.org/bugs/show_bug.cgi?id=15576.
>
> Modified:
>     libcxx/trunk/include/vector
>     libcxx/trunk/test/containers/sequences/vector/vector.cons/move.pass.cpp
>
> Modified: libcxx/trunk/include/vector
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=178064&r1=178063&r2=178064&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/vector (original)
> +++ libcxx/trunk/include/vector Tue Mar 26 14:04:56 2013
> @@ -502,6 +502,9 @@ public:
>      typedef _VSTD::reverse_iterator<iterator>         reverse_iterator;
>      typedef _VSTD::reverse_iterator<const_iterator>
> const_reverse_iterator;
>
> +    static_assert((is_same<typename allocator_type::value_type,
> value_type>::value),
> +                  "Allocator::value_type must be same type as
> value_type");
> +
>      _LIBCPP_INLINE_VISIBILITY
>      vector()
>
>  _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
>
> Modified:
> libcxx/trunk/test/containers/sequences/vector/vector.cons/move.pass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/vector/vector.cons/move.pass.cpp?rev=178064&r1=178063&r2=178064&view=diff
>
> ==============================================================================
> ---
> libcxx/trunk/test/containers/sequences/vector/vector.cons/move.pass.cpp
> (original)
> +++
> libcxx/trunk/test/containers/sequences/vector/vector.cons/move.pass.cpp Tue
> Mar 26 14:04:56 2013
> @@ -45,5 +45,13 @@ int main()
>          assert(l.empty());
>          assert(l2.get_allocator() == lo.get_allocator());
>      }
> +    {
> +        int a1[] = {1, 3, 7, 9, 10};
> +        std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
> +        std::vector<int>::const_iterator i = c1.begin();
> +        std::vector<int> c2 = std::move(c1);
> +        std::vector<int>::iterator j = c2.erase(i);
> +        assert(*j == 3);
> +    }
>  #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
>  }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>

I am really glad to see work on the "debuggability" of the libc++ library.
It had been a while since there had been any updates on it!

Are there specific plans for other parts of the STL ? (other containers or
for example having a dynamic check that algorithms expecting a sorted range
are actually given such a range ?)

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130326/688c2a35/attachment.html>


More information about the cfe-commits mailing list