[libcxx] r224658 - Move test into test/std subdirectory.

Eric Fiselier eric at efcs.ca
Fri Dec 19 17:40:31 PST 2014


Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,201 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// void swap(multiset& m);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int V;
+    typedef std::multiset<int> M;
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,177 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// void swap(multiset& m);
+
+#include <set>
+#include <cassert>
+#include "test_allocator.h"
+#include "../../../test_compare.h"
+
+int main()
+{
+    typedef int V;
+    typedef std::multiset<int> M;
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        typedef test_allocator<V> A;
+        typedef test_compare<std::less<int> > C;
+        typedef std::set<int, C, A> M;
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+        assert(m1.key_comp() == C(2));
+        assert(m1.get_allocator() == A(1));
+        assert(m2.key_comp() == C(1));
+        assert(m2.get_allocator() == A(2));
+    }
+    {
+        typedef other_allocator<V> A;
+        typedef test_compare<std::less<int> > C;
+        typedef std::set<int, C, A> M;
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+        assert(m1.key_comp() == C(2));
+        assert(m1.get_allocator() == A(2));
+        assert(m2.key_comp() == C(1));
+        assert(m2.get_allocator() == A(1));
+    }
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// void swap(multiset& c)
+//     noexcept(!allocator_type::propagate_on_container_swap::value ||
+//              __is_nothrow_swappable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_comp
+{
+    typedef T value_type;
+    
+    some_comp() {}
+    some_comp(const some_comp&) {}
+    void deallocate(void*, unsigned) {}
+
+    typedef std::true_type propagate_on_container_swap;
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::multiset<MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+        C c1, c2;
+        static_assert(!noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/scary.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/scary.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/scary.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/scary.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set class multiset
+
+// Extension:  SCARY/N2913 iterator compatibility between set and multiset
+
+#include <set>
+
+int main()
+{
+    typedef std::set<int> M1;
+    typedef std::multiset<int> M2;
+    M2::iterator i;
+    M1::iterator j = i;
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// size_type size() const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multiset<int> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1));
+    assert(m.size() == 2);
+    m.insert(M::value_type(2));
+    assert(m.size() == 3);
+    m.erase(m.begin());
+    assert(m.size() == 2);
+    m.erase(m.begin());
+    assert(m.size() == 1);
+    m.erase(m.begin());
+    assert(m.size() == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1));
+    assert(m.size() == 2);
+    m.insert(M::value_type(2));
+    assert(m.size() == 3);
+    m.erase(m.begin());
+    assert(m.size() == 2);
+    m.erase(m.begin());
+    assert(m.size() == 1);
+    m.erase(m.begin());
+    assert(m.size() == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// template <class Key, class Compare = less<Key>,
+//           class Allocator = allocator<Key>>
+// class multiset
+// {
+// public:
+//     // types:
+//     typedef Key                                      key_type;
+//     typedef key_type                                 value_type;
+//     typedef Compare                                  key_compare;
+//     typedef key_compare                              value_compare;
+//     typedef Allocator                                allocator_type;
+//     typedef typename allocator_type::reference       reference;
+//     typedef typename allocator_type::const_reference const_reference;
+//     typedef typename allocator_type::pointer         pointer;
+//     typedef typename allocator_type::const_pointer   const_pointer;
+//     typedef typename allocator_type::size_type       size_type;
+//     typedef typename allocator_type::difference_type difference_type;
+//     ...
+// };
+
+#include <set>
+#include <type_traits>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multiset<int> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::value_type, int>::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::value_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), "");
+    static_assert((std::is_same<C::reference, int&>::value), "");
+    static_assert((std::is_same<C::const_reference, const int&>::value), "");
+    static_assert((std::is_same<C::pointer, int*>::value), "");
+    static_assert((std::is_same<C::const_pointer, const int*>::value), "");
+    static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+    static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::value_type, int>::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::value_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, min_allocator<int>>::value), "");
+    static_assert((std::is_same<C::reference, int&>::value), "");
+    static_assert((std::is_same<C::const_reference, const int&>::value), "");
+    static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
+    static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
+//  min_allocator doesn't have a size_type, so one gets synthesized
+    static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
+    static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/upper_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/upper_bound.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/upper_bound.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/upper_bound.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,222 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+//       iterator upper_bound(const key_type& k);
+// const_iterator upper_bound(const key_type& k) const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef int V;
+    typedef std::multiset<int> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            5,
+            5,
+            7,
+            7,
+            7,
+            9,
+            9,
+            9
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(5);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 9));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 9));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            5,
+            5,
+            7,
+            7,
+            7,
+            9,
+            9,
+            9
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(5);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 9));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 9));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            5,
+            5,
+            7,
+            7,
+            7,
+            9,
+            9,
+            9
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(5);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 9));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 9));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            5,
+            5,
+            7,
+            7,
+            7,
+            9,
+            9,
+            9
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(5);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 9));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 9));
+    }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::multiset<V, std::less<>> M;
+
+    typedef M::iterator R;
+    V ar[] =
+    {
+        5,
+        5,
+        5,
+        7,
+        7,
+        7,
+        9,
+        9,
+        9
+    };
+    M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.upper_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.upper_bound(5);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(6);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(7);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(8);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(9);
+    assert(r == next(m.begin(), 9));
+    r = m.upper_bound(11);
+    assert(r == next(m.begin(), 9));
+    }
+
+    {
+    typedef PrivateConstructor V;
+    typedef std::multiset<V, std::less<>> M;
+
+    typedef M::iterator R;
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 9 ));
+
+    R r = m.upper_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.upper_bound(5);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(6);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(7);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(8);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(9);
+    assert(r == next(m.begin(), 9));
+    r = m.upper_bound(11);
+    assert(r == next(m.begin(), 9));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/clear.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// void clear();
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::set<int> M;
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        m.clear();
+        assert(m.size() == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        m.clear();
+        assert(m.size() == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/count.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/count.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/count.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,168 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// size_type count(const key_type& k) const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+        typedef int V;
+        typedef std::set<int> M;
+        typedef M::size_type R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(5);
+        assert(r == 1);
+        r = m.count(6);
+        assert(r == 1);
+        r = m.count(7);
+        assert(r == 1);
+        r = m.count(8);
+        assert(r == 1);
+        r = m.count(9);
+        assert(r == 1);
+        r = m.count(10);
+        assert(r == 1);
+        r = m.count(11);
+        assert(r == 1);
+        r = m.count(12);
+        assert(r == 1);
+        r = m.count(4);
+        assert(r == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int V;
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef M::size_type R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(5);
+        assert(r == 1);
+        r = m.count(6);
+        assert(r == 1);
+        r = m.count(7);
+        assert(r == 1);
+        r = m.count(8);
+        assert(r == 1);
+        r = m.count(9);
+        assert(r == 1);
+        r = m.count(10);
+        assert(r == 1);
+        r = m.count(11);
+        assert(r == 1);
+        r = m.count(12);
+        assert(r == 1);
+        r = m.count(4);
+        assert(r == 0);
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+        typedef int V;
+        typedef std::set<int, std::less<>> M;
+        typedef M::size_type R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(5);
+        assert(r == 1);
+        r = m.count(6);
+        assert(r == 1);
+        r = m.count(7);
+        assert(r == 1);
+        r = m.count(8);
+        assert(r == 1);
+        r = m.count(9);
+        assert(r == 1);
+        r = m.count(10);
+        assert(r == 1);
+        r = m.count(11);
+        assert(r == 1);
+        r = m.count(12);
+        assert(r == 1);
+        r = m.count(4);
+        assert(r == 0);
+    }
+    {
+    typedef PrivateConstructor V;
+    typedef std::set<V, std::less<>> M;
+        typedef M::size_type R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 6 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 8 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 10 ));
+    m.insert ( V::make ( 11 ));
+    m.insert ( V::make ( 12 ));
+
+    R r = m.count(5);
+    assert(r == 1);
+    r = m.count(6);
+    assert(r == 1);
+    r = m.count(7);
+    assert(r == 1);
+    r = m.count(8);
+    assert(r == 1);
+    r = m.count(9);
+    assert(r == 1);
+    r = m.count(10);
+    assert(r == 1);
+    r = m.count(11);
+    assert(r == 1);
+    r = m.count(12);
+    assert(r == 1);
+    r = m.count(4);
+    assert(r == 0);
+    }
+#endif
+
+}

Added: libcxx/trunk/test/std/containers/associative/set/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// template <class... Args>
+//   pair<iterator, bool> emplace(Args&&... args);
+
+#include <set>
+#include <cassert>
+
+#include "../../Emplaceable.h"
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::set<DefaultOnly> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        assert(DefaultOnly::count == 0);
+        R r = m.emplace();
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+
+        r = m.emplace();
+        assert(!r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::set<Emplaceable> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.emplace();
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == Emplaceable());
+        r = m.emplace(2, 3.5);
+        assert(r.second);
+        assert(r.first == next(m.begin()));
+        assert(m.size() == 2);
+        assert(*r.first == Emplaceable(2, 3.5));
+        r = m.emplace(2, 3.5);
+        assert(!r.second);
+        assert(r.first == next(m.begin()));
+        assert(m.size() == 2);
+        assert(*r.first == Emplaceable(2, 3.5));
+    }
+    {
+        typedef std::set<int> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.emplace(M::value_type(2));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*r.first == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.emplace(M::value_type(2));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*r.first == 2);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/set/emplace_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/emplace_hint.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/emplace_hint.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/emplace_hint.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// template <class... Args>
+//   iterator emplace_hint(const_iterator position, Args&&... args);
+
+#include <set>
+#include <cassert>
+
+#include "../../Emplaceable.h"
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::set<DefaultOnly> M;
+        typedef M::iterator R;
+        M m;
+        assert(DefaultOnly::count == 0);
+        R r = m.emplace_hint(m.cend());
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+
+        r = m.emplace_hint(m.cbegin());
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::set<Emplaceable> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace_hint(m.cend());
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == Emplaceable());
+        r = m.emplace_hint(m.cend(), 2, 3.5);
+        assert(r == next(m.begin()));
+        assert(m.size() == 2);
+        assert(*r == Emplaceable(2, 3.5));
+        r = m.emplace_hint(m.cbegin(), 2, 3.5);
+        assert(r == next(m.begin()));
+        assert(m.size() == 2);
+        assert(*r == Emplaceable(2, 3.5));
+    }
+    {
+        typedef std::set<int> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace_hint(m.cend(), M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace_hint(m.cend(), M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/set/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/empty.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// bool empty() const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::set<int> M;
+    M m;
+    assert(m.empty());
+    m.insert(M::value_type(1));
+    assert(!m.empty());
+    m.clear();
+    assert(m.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    M m;
+    assert(m.empty());
+    m.insert(M::value_type(1));
+    assert(!m.empty());
+    m.clear();
+    assert(m.empty());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/equal_range.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/equal_range.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/equal_range.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,370 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// pair<iterator,iterator>             equal_range(const key_type& k);
+// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef int V;
+    typedef std::set<int> M;
+    {
+        typedef std::pair<M::iterator, M::iterator> R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.equal_range(5);
+        assert(r.first == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 1));
+        r = m.equal_range(7);
+        assert(r.first == next(m.begin(), 1));
+        assert(r.second == next(m.begin(), 2));
+        r = m.equal_range(9);
+        assert(r.first == next(m.begin(), 2));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(11);
+        assert(r.first == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 4));
+        r = m.equal_range(13);
+        assert(r.first == next(m.begin(), 4));
+        assert(r.second == next(m.begin(), 5));
+        r = m.equal_range(15);
+        assert(r.first == next(m.begin(), 5));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(17);
+        assert(r.first == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 7));
+        r = m.equal_range(19);
+        assert(r.first == next(m.begin(), 7));
+        assert(r.second == next(m.begin(), 8));
+        r = m.equal_range(4);
+        assert(r.first == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 0));
+        r = m.equal_range(6);
+        assert(r.first == next(m.begin(), 1));
+        assert(r.second == next(m.begin(), 1));
+        r = m.equal_range(8);
+        assert(r.first == next(m.begin(), 2));
+        assert(r.second == next(m.begin(), 2));
+        r = m.equal_range(10);
+        assert(r.first == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(12);
+        assert(r.first == next(m.begin(), 4));
+        assert(r.second == next(m.begin(), 4));
+        r = m.equal_range(14);
+        assert(r.first == next(m.begin(), 5));
+        assert(r.second == next(m.begin(), 5));
+        r = m.equal_range(16);
+        assert(r.first == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(18);
+        assert(r.first == next(m.begin(), 7));
+        assert(r.second == next(m.begin(), 7));
+        r = m.equal_range(20);
+        assert(r.first == next(m.begin(), 8));
+        assert(r.second == next(m.begin(), 8));
+    }
+    {
+        typedef std::pair<M::const_iterator, M::const_iterator> R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.equal_range(5);
+        assert(r.first == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 1));
+        r = m.equal_range(7);
+        assert(r.first == next(m.begin(), 1));
+        assert(r.second == next(m.begin(), 2));
+        r = m.equal_range(9);
+        assert(r.first == next(m.begin(), 2));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(11);
+        assert(r.first == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 4));
+        r = m.equal_range(13);
+        assert(r.first == next(m.begin(), 4));
+        assert(r.second == next(m.begin(), 5));
+        r = m.equal_range(15);
+        assert(r.first == next(m.begin(), 5));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(17);
+        assert(r.first == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 7));
+        r = m.equal_range(19);
+        assert(r.first == next(m.begin(), 7));
+        assert(r.second == next(m.begin(), 8));
+        r = m.equal_range(4);
+        assert(r.first == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 0));
+        r = m.equal_range(6);
+        assert(r.first == next(m.begin(), 1));
+        assert(r.second == next(m.begin(), 1));
+        r = m.equal_range(8);
+        assert(r.first == next(m.begin(), 2));
+        assert(r.second == next(m.begin(), 2));
+        r = m.equal_range(10);
+        assert(r.first == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(12);
+        assert(r.first == next(m.begin(), 4));
+        assert(r.second == next(m.begin(), 4));
+        r = m.equal_range(14);
+        assert(r.first == next(m.begin(), 5));
+        assert(r.second == next(m.begin(), 5));
+        r = m.equal_range(16);
+        assert(r.first == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(18);
+        assert(r.first == next(m.begin(), 7));
+        assert(r.second == next(m.begin(), 7));
+        r = m.equal_range(20);
+        assert(r.first == next(m.begin(), 8));
+        assert(r.second == next(m.begin(), 8));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    typedef std::pair<M::iterator, M::iterator> R;
+    V ar[] =
+    {
+        5,
+        7,
+        9,
+        11,
+        13,
+        15,
+        17,
+        19
+    };
+    M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.equal_range(5);
+    assert(r.first == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 1));
+    r = m.equal_range(7);
+    assert(r.first == next(m.begin(), 1));
+    assert(r.second == next(m.begin(), 2));
+    r = m.equal_range(9);
+    assert(r.first == next(m.begin(), 2));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(11);
+    assert(r.first == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 4));
+    r = m.equal_range(13);
+    assert(r.first == next(m.begin(), 4));
+    assert(r.second == next(m.begin(), 5));
+    r = m.equal_range(15);
+    assert(r.first == next(m.begin(), 5));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(17);
+    assert(r.first == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 7));
+    r = m.equal_range(19);
+    assert(r.first == next(m.begin(), 7));
+    assert(r.second == next(m.begin(), 8));
+    r = m.equal_range(4);
+    assert(r.first == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 0));
+    r = m.equal_range(6);
+    assert(r.first == next(m.begin(), 1));
+    assert(r.second == next(m.begin(), 1));
+    r = m.equal_range(8);
+    assert(r.first == next(m.begin(), 2));
+    assert(r.second == next(m.begin(), 2));
+    r = m.equal_range(10);
+    assert(r.first == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(12);
+    assert(r.first == next(m.begin(), 4));
+    assert(r.second == next(m.begin(), 4));
+    r = m.equal_range(14);
+    assert(r.first == next(m.begin(), 5));
+    assert(r.second == next(m.begin(), 5));
+    r = m.equal_range(16);
+    assert(r.first == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(18);
+    assert(r.first == next(m.begin(), 7));
+    assert(r.second == next(m.begin(), 7));
+    r = m.equal_range(20);
+    assert(r.first == next(m.begin(), 8));
+    assert(r.second == next(m.begin(), 8));
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::set<V, std::less<>> M;
+    {
+        typedef std::pair<M::iterator, M::iterator> R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.equal_range(5);
+        assert(r.first == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 1));
+        r = m.equal_range(7);
+        assert(r.first == next(m.begin(), 1));
+        assert(r.second == next(m.begin(), 2));
+        r = m.equal_range(9);
+        assert(r.first == next(m.begin(), 2));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(11);
+        assert(r.first == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 4));
+        r = m.equal_range(13);
+        assert(r.first == next(m.begin(), 4));
+        assert(r.second == next(m.begin(), 5));
+        r = m.equal_range(15);
+        assert(r.first == next(m.begin(), 5));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(17);
+        assert(r.first == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 7));
+        r = m.equal_range(19);
+        assert(r.first == next(m.begin(), 7));
+        assert(r.second == next(m.begin(), 8));
+        r = m.equal_range(4);
+        assert(r.first == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 0));
+        r = m.equal_range(6);
+        assert(r.first == next(m.begin(), 1));
+        assert(r.second == next(m.begin(), 1));
+        r = m.equal_range(8);
+        assert(r.first == next(m.begin(), 2));
+        assert(r.second == next(m.begin(), 2));
+        r = m.equal_range(10);
+        assert(r.first == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(12);
+        assert(r.first == next(m.begin(), 4));
+        assert(r.second == next(m.begin(), 4));
+        r = m.equal_range(14);
+        assert(r.first == next(m.begin(), 5));
+        assert(r.second == next(m.begin(), 5));
+        r = m.equal_range(16);
+        assert(r.first == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(18);
+        assert(r.first == next(m.begin(), 7));
+        assert(r.second == next(m.begin(), 7));
+        r = m.equal_range(20);
+        assert(r.first == next(m.begin(), 8));
+        assert(r.second == next(m.begin(), 8));
+        }
+    }
+    {
+    typedef PrivateConstructor V;
+    typedef std::set<V, std::less<>> M;
+    typedef std::pair<M::iterator, M::iterator> R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 11 ));
+    m.insert ( V::make ( 13 ));
+    m.insert ( V::make ( 15 ));
+    m.insert ( V::make ( 17 ));
+    m.insert ( V::make ( 19 ));
+
+    R r = m.equal_range(5);
+    assert(r.first == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 1));
+    r = m.equal_range(7);
+    assert(r.first == next(m.begin(), 1));
+    assert(r.second == next(m.begin(), 2));
+    r = m.equal_range(9);
+    assert(r.first == next(m.begin(), 2));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(11);
+    assert(r.first == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 4));
+    r = m.equal_range(13);
+    assert(r.first == next(m.begin(), 4));
+    assert(r.second == next(m.begin(), 5));
+    r = m.equal_range(15);
+    assert(r.first == next(m.begin(), 5));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(17);
+    assert(r.first == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 7));
+    r = m.equal_range(19);
+    assert(r.first == next(m.begin(), 7));
+    assert(r.second == next(m.begin(), 8));
+    r = m.equal_range(4);
+    assert(r.first == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 0));
+    r = m.equal_range(6);
+    assert(r.first == next(m.begin(), 1));
+    assert(r.second == next(m.begin(), 1));
+    r = m.equal_range(8);
+    assert(r.first == next(m.begin(), 2));
+    assert(r.second == next(m.begin(), 2));
+    r = m.equal_range(10);
+    assert(r.first == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(12);
+    assert(r.first == next(m.begin(), 4));
+    assert(r.second == next(m.begin(), 4));
+    r = m.equal_range(14);
+    assert(r.first == next(m.begin(), 5));
+    assert(r.second == next(m.begin(), 5));
+    r = m.equal_range(16);
+    assert(r.first == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(18);
+    assert(r.first == next(m.begin(), 7));
+    assert(r.second == next(m.begin(), 7));
+    r = m.equal_range(20);
+    assert(r.first == next(m.begin(), 8));
+    assert(r.second == next(m.begin(), 8));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/erase_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/erase_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/erase_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,181 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// iterator erase(const_iterator position);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::set<int> M;
+        typedef int V;
+        typedef M::iterator I;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(next(m.cbegin(), 3));
+        assert(m.size() == 7);
+        assert(i == next(m.begin(), 3));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 6);
+        assert(*next(m.begin(), 5) == 7);
+        assert(*next(m.begin(), 6) == 8);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 6);
+        assert(i == m.begin());
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+        assert(*next(m.begin(), 5) == 8);
+
+        i = m.erase(next(m.cbegin(), 5));
+        assert(m.size() == 5);
+        assert(i == m.end());
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+
+        i = m.erase(next(m.cbegin(), 1));
+        assert(m.size() == 4);
+        assert(i == next(m.begin()));
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 6);
+        assert(*next(m.begin(), 3) == 7);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 3);
+        assert(i == next(m.begin(), 2));
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 7);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 2));
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 1);
+        assert(i == next(m.begin(), 0));
+        assert(*next(m.begin(), 0) == 5);
+
+        i = m.erase(m.cbegin());
+        assert(m.size() == 0);
+        assert(i == m.begin());
+        assert(i == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef int V;
+        typedef M::iterator I;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(next(m.cbegin(), 3));
+        assert(m.size() == 7);
+        assert(i == next(m.begin(), 3));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 6);
+        assert(*next(m.begin(), 5) == 7);
+        assert(*next(m.begin(), 6) == 8);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 6);
+        assert(i == m.begin());
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+        assert(*next(m.begin(), 5) == 8);
+
+        i = m.erase(next(m.cbegin(), 5));
+        assert(m.size() == 5);
+        assert(i == m.end());
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+
+        i = m.erase(next(m.cbegin(), 1));
+        assert(m.size() == 4);
+        assert(i == next(m.begin()));
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 6);
+        assert(*next(m.begin(), 3) == 7);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 3);
+        assert(i == next(m.begin(), 2));
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 7);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 2));
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 1);
+        assert(i == next(m.begin(), 0));
+        assert(*next(m.begin(), 0) == 5);
+
+        i = m.erase(m.cbegin());
+        assert(m.size() == 0);
+        assert(i == m.begin());
+        assert(i == m.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/erase_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/erase_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/erase_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,141 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// iterator erase(const_iterator first, const_iterator last);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::set<int> M;
+        typedef int V;
+        typedef M::iterator I;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(next(m.cbegin(), 5), next(m.cbegin(), 5));
+        assert(m.size() == 8);
+        assert(i == next(m.begin(), 5));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 4);
+        assert(*next(m.begin(), 4) == 5);
+        assert(*next(m.begin(), 5) == 6);
+        assert(*next(m.begin(), 6) == 7);
+        assert(*next(m.begin(), 7) == 8);
+
+        i = m.erase(next(m.cbegin(), 3), next(m.cbegin(), 4));
+        assert(m.size() == 7);
+        assert(i == next(m.begin(), 3));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 6);
+        assert(*next(m.begin(), 5) == 7);
+        assert(*next(m.begin(), 6) == 8);
+
+        i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 5));
+        assert(m.size() == 4);
+        assert(i == next(m.begin(), 2));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 7);
+        assert(*next(m.begin(), 3) == 8);
+
+        i = m.erase(next(m.cbegin(), 0), next(m.cbegin(), 2));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 0));
+        assert(*next(m.begin(), 0) == 7);
+        assert(*next(m.begin(), 1) == 8);
+
+        i = m.erase(m.cbegin(), m.cend());
+        assert(m.size() == 0);
+        assert(i == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef int V;
+        typedef M::iterator I;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(next(m.cbegin(), 5), next(m.cbegin(), 5));
+        assert(m.size() == 8);
+        assert(i == next(m.begin(), 5));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 4);
+        assert(*next(m.begin(), 4) == 5);
+        assert(*next(m.begin(), 5) == 6);
+        assert(*next(m.begin(), 6) == 7);
+        assert(*next(m.begin(), 7) == 8);
+
+        i = m.erase(next(m.cbegin(), 3), next(m.cbegin(), 4));
+        assert(m.size() == 7);
+        assert(i == next(m.begin(), 3));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 6);
+        assert(*next(m.begin(), 5) == 7);
+        assert(*next(m.begin(), 6) == 8);
+
+        i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 5));
+        assert(m.size() == 4);
+        assert(i == next(m.begin(), 2));
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 7);
+        assert(*next(m.begin(), 3) == 8);
+
+        i = m.erase(next(m.cbegin(), 0), next(m.cbegin(), 2));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 0));
+        assert(*next(m.begin(), 0) == 7);
+        assert(*next(m.begin(), 1) == 8);
+
+        i = m.erase(m.cbegin(), m.cend());
+        assert(m.size() == 0);
+        assert(i == m.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/erase_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/erase_key.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/erase_key.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/erase_key.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,203 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// size_type erase(const key_type& k);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::set<int> M;
+        typedef int V;
+        typedef M::size_type I;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(9);
+        assert(m.size() == 8);
+        assert(i == 0);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 4);
+        assert(*next(m.begin(), 4) == 5);
+        assert(*next(m.begin(), 5) == 6);
+        assert(*next(m.begin(), 6) == 7);
+        assert(*next(m.begin(), 7) == 8);
+
+        i = m.erase(4);
+        assert(m.size() == 7);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 6);
+        assert(*next(m.begin(), 5) == 7);
+        assert(*next(m.begin(), 6) == 8);
+
+        i = m.erase(1);
+        assert(m.size() == 6);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+        assert(*next(m.begin(), 5) == 8);
+
+        i = m.erase(8);
+        assert(m.size() == 5);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+
+        i = m.erase(3);
+        assert(m.size() == 4);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 6);
+        assert(*next(m.begin(), 3) == 7);
+
+        i = m.erase(6);
+        assert(m.size() == 3);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 7);
+
+        i = m.erase(7);
+        assert(m.size() == 2);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+
+        i = m.erase(2);
+        assert(m.size() == 1);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 5);
+
+        i = m.erase(5);
+        assert(m.size() == 0);
+        assert(i == 1);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef int V;
+        typedef M::size_type I;
+        V ar[] =
+        {
+            1,
+            2,
+            3,
+            4,
+            5,
+            6,
+            7,
+            8
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(9);
+        assert(m.size() == 8);
+        assert(i == 0);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 4);
+        assert(*next(m.begin(), 4) == 5);
+        assert(*next(m.begin(), 5) == 6);
+        assert(*next(m.begin(), 6) == 7);
+        assert(*next(m.begin(), 7) == 8);
+
+        i = m.erase(4);
+        assert(m.size() == 7);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 2);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 6);
+        assert(*next(m.begin(), 5) == 7);
+        assert(*next(m.begin(), 6) == 8);
+
+        i = m.erase(1);
+        assert(m.size() == 6);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+        assert(*next(m.begin(), 5) == 8);
+
+        i = m.erase(8);
+        assert(m.size() == 5);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 5);
+        assert(*next(m.begin(), 3) == 6);
+        assert(*next(m.begin(), 4) == 7);
+
+        i = m.erase(3);
+        assert(m.size() == 4);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 6);
+        assert(*next(m.begin(), 3) == 7);
+
+        i = m.erase(6);
+        assert(m.size() == 3);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+        assert(*next(m.begin(), 2) == 7);
+
+        i = m.erase(7);
+        assert(m.size() == 2);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 2);
+        assert(*next(m.begin(), 1) == 5);
+
+        i = m.erase(2);
+        assert(m.size() == 1);
+        assert(i == 1);
+        assert(*next(m.begin(), 0) == 5);
+
+        i = m.erase(5);
+        assert(m.size() == 0);
+        assert(i == 1);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/find.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/find.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/find.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/find.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,240 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+//       iterator find(const key_type& k);
+// const_iterator find(const key_type& k) const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef int V;
+    typedef std::set<int> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.find(5);
+        assert(r == m.begin());
+        r = m.find(6);
+        assert(r == next(m.begin()));
+        r = m.find(7);
+        assert(r == next(m.begin(), 2));
+        r = m.find(8);
+        assert(r == next(m.begin(), 3));
+        r = m.find(9);
+        assert(r == next(m.begin(), 4));
+        r = m.find(10);
+        assert(r == next(m.begin(), 5));
+        r = m.find(11);
+        assert(r == next(m.begin(), 6));
+        r = m.find(12);
+        assert(r == next(m.begin(), 7));
+        r = m.find(4);
+        assert(r == next(m.begin(), 8));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.find(5);
+        assert(r == m.begin());
+        r = m.find(6);
+        assert(r == next(m.begin()));
+        r = m.find(7);
+        assert(r == next(m.begin(), 2));
+        r = m.find(8);
+        assert(r == next(m.begin(), 3));
+        r = m.find(9);
+        assert(r == next(m.begin(), 4));
+        r = m.find(10);
+        assert(r == next(m.begin(), 5));
+        r = m.find(11);
+        assert(r == next(m.begin(), 6));
+        r = m.find(12);
+        assert(r == next(m.begin(), 7));
+        r = m.find(4);
+        assert(r == next(m.begin(), 8));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.find(5);
+        assert(r == m.begin());
+        r = m.find(6);
+        assert(r == next(m.begin()));
+        r = m.find(7);
+        assert(r == next(m.begin(), 2));
+        r = m.find(8);
+        assert(r == next(m.begin(), 3));
+        r = m.find(9);
+        assert(r == next(m.begin(), 4));
+        r = m.find(10);
+        assert(r == next(m.begin(), 5));
+        r = m.find(11);
+        assert(r == next(m.begin(), 6));
+        r = m.find(12);
+        assert(r == next(m.begin(), 7));
+        r = m.find(4);
+        assert(r == next(m.begin(), 8));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.find(5);
+        assert(r == m.begin());
+        r = m.find(6);
+        assert(r == next(m.begin()));
+        r = m.find(7);
+        assert(r == next(m.begin(), 2));
+        r = m.find(8);
+        assert(r == next(m.begin(), 3));
+        r = m.find(9);
+        assert(r == next(m.begin(), 4));
+        r = m.find(10);
+        assert(r == next(m.begin(), 5));
+        r = m.find(11);
+        assert(r == next(m.begin(), 6));
+        r = m.find(12);
+        assert(r == next(m.begin(), 7));
+        r = m.find(4);
+        assert(r == next(m.begin(), 8));
+    }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::set<V, std::less<>> M;
+    typedef M::iterator R;
+
+    V ar[] =
+    {
+        5,
+        6,
+        7,
+        8,
+        9,
+        10,
+        11,
+        12
+    };
+    M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.find(5);
+    assert(r == m.begin());
+    r = m.find(6);
+    assert(r == next(m.begin()));
+    r = m.find(7);
+    assert(r == next(m.begin(), 2));
+    r = m.find(8);
+    assert(r == next(m.begin(), 3));
+    r = m.find(9);
+    assert(r == next(m.begin(), 4));
+    r = m.find(10);
+    assert(r == next(m.begin(), 5));
+    r = m.find(11);
+    assert(r == next(m.begin(), 6));
+    r = m.find(12);
+    assert(r == next(m.begin(), 7));
+    r = m.find(4);
+    assert(r == next(m.begin(), 8));
+    }
+
+    {
+    typedef PrivateConstructor V;
+    typedef std::set<V, std::less<>> M;
+    typedef M::iterator R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 6 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 8 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 10 ));
+    m.insert ( V::make ( 11 ));
+    m.insert ( V::make ( 12 ));
+
+    R r = m.find(5);
+    assert(r == m.begin());
+    r = m.find(6);
+    assert(r == next(m.begin()));
+    r = m.find(7);
+    assert(r == next(m.begin(), 2));
+    r = m.find(8);
+    assert(r == next(m.begin(), 3));
+    r = m.find(9);
+    assert(r == next(m.begin(), 4));
+    r = m.find(10);
+    assert(r == next(m.begin(), 5));
+    r = m.find(11);
+    assert(r == next(m.begin(), 6));
+    r = m.find(12);
+    assert(r == next(m.begin(), 7));
+    r = m.find(4);
+    assert(r == next(m.begin(), 8));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/insert_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/insert_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/insert_cv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// pair<iterator, bool> insert(const value_type& v);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::set<int> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*r.first == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(*r.first == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(!r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*r.first == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(*r.first == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(!r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/insert_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/insert_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/insert_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// void insert(initializer_list<value_type> il);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::set<int> C;
+    typedef C::value_type V;
+    C m = {10, 8};
+    m.insert({1, 2, 3, 4, 5, 6});
+    assert(m.size() == 8);
+    assert(distance(m.begin(), m.end()) == m.size());
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    assert(*++i == V(8));
+    assert(*++i == V(10));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::set<int, std::less<int>, min_allocator<int>> C;
+    typedef C::value_type V;
+    C m = {10, 8};
+    m.insert({1, 2, 3, 4, 5, 6});
+    assert(m.size() == 8);
+    assert(distance(m.begin(), m.end()) == m.size());
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    assert(*++i == V(8));
+    assert(*++i == V(10));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/set/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/insert_iter_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/insert_iter_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/insert_iter_cv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// iterator insert(const_iterator position, const value_type& v);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::set<int> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.cend(), M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(m.cend(), M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.cend(), M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(m.cend(), M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/insert_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/insert_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/insert_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// template <class InputIterator>
+//   void insert(InputIterator first, InputIterator last);
+
+#include <set>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::set<int> M;
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        M m;
+        m.insert(input_iterator<const V*>(ar),
+                 input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
+        assert(m.size() == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<int, std::less<int>, min_allocator<int>> M;
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        M m;
+        m.insert(input_iterator<const V*>(ar),
+                 input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
+        assert(m.size() == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/insert_iter_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/insert_iter_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/insert_iter_rv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// iterator insert(const_iterator position, value_type&& v);
+
+#include <set>
+#include <cassert>
+
+#include "../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::set<MoveOnly> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.cend(), M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(m.cend(), M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.cend(), M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(m.cend(), M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(m.cend(), M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/set/insert_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/insert_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/insert_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/insert_rv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// pair<iterator, bool> insert(value_type&& v);
+
+#include <set>
+#include <cassert>
+
+#include "../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::set<MoveOnly> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*r.first == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(*r.first == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(!r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(*r.first == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(*r.first == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(!r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r.first == 3);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,211 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+//       iterator begin();
+// const_iterator begin() const;
+//       iterator end();
+// const_iterator end()   const;
+//
+//       reverse_iterator rbegin();
+// const_reverse_iterator rbegin() const;
+//       reverse_iterator rend();
+// const_reverse_iterator rend()   const;
+//
+// const_iterator         cbegin()  const;
+// const_iterator         cend()    const;
+// const_reverse_iterator crbegin() const;
+// const_reverse_iterator crend()   const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3,
+            4,
+            4,
+            4,
+            5,
+            5,
+            5,
+            6,
+            6,
+            6,
+            7,
+            7,
+            7,
+            8,
+            8,
+            8
+        };
+        std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(std::distance(m.begin(), m.end()) == m.size());
+        assert(std::distance(m.rbegin(), m.rend()) == m.size());
+        std::set<int>::iterator i;
+        i = m.begin();
+        std::set<int>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= m.size(); ++j, ++i)
+            assert(*i == j);
+    }
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3,
+            4,
+            4,
+            4,
+            5,
+            5,
+            5,
+            6,
+            6,
+            6,
+            7,
+            7,
+            7,
+            8,
+            8,
+            8
+        };
+        const std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(std::distance(m.begin(), m.end()) == m.size());
+        assert(std::distance(m.cbegin(), m.cend()) == m.size());
+        assert(std::distance(m.rbegin(), m.rend()) == m.size());
+        assert(std::distance(m.crbegin(), m.crend()) == m.size());
+        std::set<int>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= m.size(); ++j, ++i)
+            assert(*i == j);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3,
+            4,
+            4,
+            4,
+            5,
+            5,
+            5,
+            6,
+            6,
+            6,
+            7,
+            7,
+            7,
+            8,
+            8,
+            8
+        };
+        std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(std::distance(m.begin(), m.end()) == m.size());
+        assert(std::distance(m.rbegin(), m.rend()) == m.size());
+        std::set<int, std::less<int>, min_allocator<int>>::iterator i;
+        i = m.begin();
+        std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= m.size(); ++j, ++i)
+            assert(*i == j);
+    }
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3,
+            4,
+            4,
+            4,
+            5,
+            5,
+            5,
+            6,
+            6,
+            6,
+            7,
+            7,
+            7,
+            8,
+            8,
+            8
+        };
+        const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(std::distance(m.begin(), m.end()) == m.size());
+        assert(std::distance(m.cbegin(), m.cend()) == m.size());
+        assert(std::distance(m.rbegin(), m.rend()) == m.size());
+        assert(std::distance(m.crbegin(), m.crend()) == m.size());
+        std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= m.size(); ++j, ++i)
+            assert(*i == j);
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    { // N3644 testing
+        typedef std::set<int> C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+
+        assert (!(ii1 != ii2 ));
+
+        assert ( (ii1 == cii ));
+        assert ( (cii == ii1 ));
+        assert (!(ii1 != cii ));
+        assert (!(cii != ii1 ));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/lower_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/lower_bound.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/lower_bound.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/lower_bound.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,337 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+//       iterator lower_bound(const key_type& k);
+// const_iterator lower_bound(const key_type& k) const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef int V;
+    typedef std::set<int> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.lower_bound(5);
+        assert(r == m.begin());
+        r = m.lower_bound(7);
+        assert(r == next(m.begin()));
+        r = m.lower_bound(9);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(11);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(13);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(15);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(17);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(19);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.lower_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.lower_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.lower_bound(5);
+        assert(r == m.begin());
+        r = m.lower_bound(7);
+        assert(r == next(m.begin()));
+        r = m.lower_bound(9);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(11);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(13);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(15);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(17);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(19);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.lower_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.lower_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.lower_bound(5);
+        assert(r == m.begin());
+        r = m.lower_bound(7);
+        assert(r == next(m.begin()));
+        r = m.lower_bound(9);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(11);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(13);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(15);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(17);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(19);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.lower_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.lower_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.lower_bound(5);
+        assert(r == m.begin());
+        r = m.lower_bound(7);
+        assert(r == next(m.begin()));
+        r = m.lower_bound(9);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(11);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(13);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(15);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(17);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(19);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.lower_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.lower_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.lower_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.lower_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.lower_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.lower_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.lower_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.lower_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::set<V, std::less<>> M;
+    typedef M::iterator R;
+
+    V ar[] =
+    {
+        5,
+        7,
+        9,
+        11,
+        13,
+        15,
+        17,
+        19
+    };
+    M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.lower_bound(5);
+    assert(r == m.begin());
+    r = m.lower_bound(7);
+    assert(r == next(m.begin()));
+    r = m.lower_bound(9);
+    assert(r == next(m.begin(), 2));
+    r = m.lower_bound(11);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(13);
+    assert(r == next(m.begin(), 4));
+    r = m.lower_bound(15);
+    assert(r == next(m.begin(), 5));
+    r = m.lower_bound(17);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_bound(19);
+    assert(r == next(m.begin(), 7));
+    r = m.lower_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.lower_bound(6);
+    assert(r == next(m.begin(), 1));
+    r = m.lower_bound(8);
+    assert(r == next(m.begin(), 2));
+    r = m.lower_bound(10);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(12);
+    assert(r == next(m.begin(), 4));
+    r = m.lower_bound(14);
+    assert(r == next(m.begin(), 5));
+    r = m.lower_bound(16);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_bound(18);
+    assert(r == next(m.begin(), 7));
+    r = m.lower_bound(20);
+    assert(r == next(m.begin(), 8));
+    }
+    
+    {
+    typedef PrivateConstructor V;
+    typedef std::set<V, std::less<>> M;
+    typedef M::iterator R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 11 ));
+    m.insert ( V::make ( 13 ));
+    m.insert ( V::make ( 15 ));
+    m.insert ( V::make ( 17 ));
+    m.insert ( V::make ( 19 ));
+
+    R r = m.lower_bound(5);
+    assert(r == m.begin());
+    r = m.lower_bound(7);
+    assert(r == next(m.begin()));
+    r = m.lower_bound(9);
+    assert(r == next(m.begin(), 2));
+    r = m.lower_bound(11);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(13);
+    assert(r == next(m.begin(), 4));
+    r = m.lower_bound(15);
+    assert(r == next(m.begin(), 5));
+    r = m.lower_bound(17);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_bound(19);
+    assert(r == next(m.begin(), 7));
+    r = m.lower_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.lower_bound(6);
+    assert(r == next(m.begin(), 1));
+    r = m.lower_bound(8);
+    assert(r == next(m.begin(), 2));
+    r = m.lower_bound(10);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(12);
+    assert(r == next(m.begin(), 4));
+    r = m.lower_bound(14);
+    assert(r == next(m.begin(), 5));
+    r = m.lower_bound(16);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_bound(18);
+    assert(r == next(m.begin(), 7));
+    r = m.lower_bound(20);
+    assert(r == next(m.begin(), 8));
+    }
+#endif
+
+}

Added: libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/max_size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// size_type max_size() const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::set<int> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(const allocator_type& a);
+
+#include <set>
+#include <cassert>
+
+#include "test_allocator.h"
+
+int main()
+{
+    typedef std::less<int> C;
+    typedef test_allocator<int> A;
+    std::set<int, C, A> m(A(5));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.get_allocator() == A(5));
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set& operator=(initializer_list<value_type> il);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::set<int> C;
+    typedef C::value_type V;
+    C m = {10, 8};
+    m = {1, 2, 3, 4, 5, 6};
+    assert(m.size() == 6);
+    assert(distance(m.begin(), m.end()) == 6);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::set<int, std::less<int>, min_allocator<int>> C;
+    typedef C::value_type V;
+    C m = {10, 8};
+    m = {1, 2, 3, 4, 5, 6};
+    assert(m.size() == 6);
+    assert(distance(m.begin(), m.end()) == 6);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/compare.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// explicit set(const value_compare& comp);
+
+#include <set>
+#include <cassert>
+
+#include "../../../test_compare.h"
+
+int main()
+{
+    typedef test_compare<std::less<int> > C;
+    std::set<int, C> m(C(3));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(3));
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/compare_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(const value_compare& comp, const allocator_type& a);
+
+#include <set>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+
+int main()
+{
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<int> A;
+    std::set<int, C, A> m(C(4), A(5));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(4));
+    assert(m.get_allocator() == A(5));
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(const set& m);
+
+#include <set>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+
+int main()
+{
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::set<int, C, A> m = mo;
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 3);
+        assert(distance(m.begin(), m.end()) == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 3);
+        assert(distance(mo.begin(), mo.end()) == 3);
+        assert(*mo.begin() == 1);
+        assert(*next(mo.begin()) == 2);
+        assert(*next(mo.begin(), 2) == 3);
+    }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef other_allocator<V> A;
+        std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::set<int, C, A> m = mo;
+        assert(m.get_allocator() == A(-2));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 3);
+        assert(distance(m.begin(), m.end()) == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 3);
+        assert(distance(mo.begin(), mo.end()) == 3);
+        assert(*mo.begin() == 1);
+        assert(*next(mo.begin()) == 2);
+        assert(*next(mo.begin(), 2) == 3);
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/copy_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(const set& m, const allocator_type& a);
+
+#include <set>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+
+int main()
+{
+    typedef int V;
+    V ar[] =
+    {
+        1,
+        1,
+        1,
+        2,
+        2,
+        2,
+        3,
+        3,
+        3
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<V> A;
+    std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+    std::set<int, C, A> m(mo, A(3));
+    assert(m.get_allocator() == A(3));
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == 1);
+    assert(*next(m.begin()) == 2);
+    assert(*next(m.begin(), 2) == 3);
+
+    assert(mo.get_allocator() == A(7));
+    assert(mo.key_comp() == C(5));
+    assert(mo.size() == 3);
+    assert(distance(mo.begin(), mo.end()) == 3);
+    assert(*mo.begin() == 1);
+    assert(*next(mo.begin()) == 2);
+    assert(*next(mo.begin(), 2) == 3);
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/copy_assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set& operator=(const set& s);
+
+#include <set>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+
+int main()
+{
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
+        std::set<int, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
+        m = mo;
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 3);
+        assert(distance(m.begin(), m.end()) == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+
+        assert(mo.get_allocator() == A(2));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 3);
+        assert(distance(mo.begin(), mo.end()) == 3);
+        assert(*mo.begin() == 1);
+        assert(*next(mo.begin()) == 2);
+        assert(*next(mo.begin(), 2) == 3);
+    }
+    {
+        typedef int V;
+        const V ar[] =
+        {
+            1,
+            2,
+            3
+        };
+        std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        std::set<int> *p = &m;
+        m = *p;
+
+        assert(m.size() == 3);
+        assert(std::equal(m.begin(), m.end(), ar));
+    }
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef other_allocator<V> A;
+        std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
+        std::set<int, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
+        m = mo;
+        assert(m.get_allocator() == A(2));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 3);
+        assert(distance(m.begin(), m.end()) == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+
+        assert(mo.get_allocator() == A(2));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 3);
+        assert(distance(mo.begin(), mo.end()) == 3);
+        assert(*mo.begin() == 1);
+        assert(*next(mo.begin()) == 2);
+        assert(*next(mo.begin(), 2) == 3);
+    }
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set();
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    std::set<int> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+    std::set<int, std::less<int>, min_allocator<int>> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+    {
+    std::set<int> m = {};
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// set()
+//    noexcept(
+//        is_nothrow_default_constructible<allocator_type>::value &&
+//        is_nothrow_default_constructible<key_compare>::value &&
+//        is_nothrow_copy_constructible<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_comp
+{
+    typedef T value_type;
+    some_comp();
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::set<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// ~set() // implied noexcept;
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+#if __has_feature(cxx_noexcept)
+
+template <class T>
+struct some_comp
+{
+    typedef T value_type;
+    ~some_comp() noexcept(false);
+};
+
+#endif
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::set<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(initializer_list<value_type> il, const key_compare& comp = key_compare());
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::set<int> C;
+    typedef C::value_type V;
+    C m = {1, 2, 3, 4, 5, 6};
+    assert(m.size() == 6);
+    assert(distance(m.begin(), m.end()) == 6);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::set<int, std::less<int>, min_allocator<int>> C;
+    typedef C::value_type V;
+    C m = {1, 2, 3, 4, 5, 6};
+    assert(m.size() == 6);
+    assert(distance(m.begin(), m.end()) == 6);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(initializer_list<value_type> il, const key_compare& comp = key_compare());
+
+#include <set>
+#include <cassert>
+#include "../../../test_compare.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    typedef test_compare<std::less<int> > Cmp;
+    typedef std::set<int, Cmp> C;
+    typedef C::value_type V;
+    C m({1, 2, 3, 4, 5, 6}, Cmp(10));
+    assert(m.size() == 6);
+    assert(distance(m.begin(), m.end()) == 6);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    assert(m.key_comp() == Cmp(10));
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+// set(initializer_list<value_type> il, const allocator_type& a);
+
+#include <set>
+#include <cassert>
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef test_compare<std::less<int> > Cmp;
+    typedef test_allocator<int> A;
+    typedef std::set<int, Cmp, A> C;
+    typedef C::value_type V;
+    C m({1, 2, 3, 4, 5, 6}, Cmp(10), A(4));
+    assert(m.size() == 6);
+    assert(distance(m.begin(), m.end()) == 6);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    assert(m.key_comp() == Cmp(10));
+    assert(m.get_allocator() == A(4));
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef test_compare<std::less<int> > Cmp;
+    typedef test_allocator<int> A;
+    typedef std::set<int, Cmp, A> C;
+    typedef C::value_type V;
+    C m({1, 2, 3, 4, 5, 6}, A(4));
+    assert(m.size() == 6);
+    assert(distance(m.begin(), m.end()) == 6);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1));
+    assert(*++i == V(2));
+    assert(*++i == V(3));
+    assert(*++i == V(4));
+    assert(*++i == V(5));
+    assert(*++i == V(6));
+    assert(m.get_allocator() == A(4));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// template <class InputIterator>
+//     set(InputIterator first, InputIterator last);
+
+#include <set>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int V;
+    V ar[] =
+    {
+        1,
+        1,
+        1,
+        2,
+        2,
+        2,
+        3,
+        3,
+        3
+    };
+    std::set<V> m(input_iterator<const int*>(ar),
+                  input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == 1);
+    assert(*next(m.begin()) == 2);
+    assert(*next(m.begin(), 2) == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    V ar[] =
+    {
+        1,
+        1,
+        1,
+        2,
+        2,
+        2,
+        3,
+        3,
+        3
+    };
+    std::set<V, std::less<int>, min_allocator<int>> m(input_iterator<const int*>(ar),
+                  input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == 1);
+    assert(*next(m.begin()) == 2);
+    assert(*next(m.begin(), 2) == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// template <class InputIterator>
+//     set(InputIterator first, InputIterator last,
+//         const value_compare& comp, const allocator_type& a);
+//
+// template <class InputIterator>
+//     set(InputIterator first, InputIterator last,
+//         const allocator_type& a);
+
+#include <set>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+
+int main()
+{
+    typedef int V;
+    V ar[] =
+    {
+        1,
+        1,
+        1,
+        2,
+        2,
+        2,
+        3,
+        3,
+        3
+    };
+    typedef test_compare<std::less<V> > C;
+    typedef test_allocator<V> A;
+    std::set<V, C, A> m(input_iterator<const V*>(ar),
+                        input_iterator<const V*>(ar+sizeof(ar)/sizeof(ar[0])),
+                        C(5), A(7));
+    assert(m.value_comp() == C(5));
+    assert(m.get_allocator() == A(7));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == 1);
+    assert(*next(m.begin()) == 2);
+    assert(*next(m.begin(), 2) == 3);
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    V ar[] =
+    {
+        1,
+        1,
+        1,
+        2,
+        2,
+        2,
+        3,
+        3,
+        3
+    };
+    typedef test_allocator<V> A;
+    typedef test_compare<std::less<int> > C;
+    A a(7);
+    std::set<V, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == 1);
+    assert(*next(m.begin()) == 2);
+    assert(*next(m.begin(), 2) == 3);
+    assert(m.get_allocator() == a);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// template <class InputIterator>
+//     set(InputIterator first, InputIterator last, const value_compare& comp);
+
+#include <set>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "../../../test_compare.h"
+
+int main()
+{
+    typedef int V;
+    V ar[] =
+    {
+        1,
+        1,
+        1,
+        2,
+        2,
+        2,
+        3,
+        3,
+        3
+    };
+    typedef test_compare<std::less<V> > C;
+    std::set<V, C> m(input_iterator<const V*>(ar),
+                     input_iterator<const V*>(ar+sizeof(ar)/sizeof(ar[0])), C(5));
+    assert(m.value_comp() == C(5));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == 1);
+    assert(*next(m.begin()) == 2);
+    assert(*next(m.begin(), 2) == 3);
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(set&& s);
+
+#include <set>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef int V;
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::set<int, C, A> mo(C(5), A(7));
+        std::set<int, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 0);
+        assert(distance(m.begin(), m.end()) == 0);
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 0);
+        assert(distance(mo.begin(), mo.end()) == 0);
+    }
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::set<int, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 3);
+        assert(distance(m.begin(), m.end()) == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 0);
+        assert(distance(mo.begin(), mo.end()) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int V;
+        V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef min_allocator<V> A;
+        std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+        std::set<int, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A());
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 3);
+        assert(distance(m.begin(), m.end()) == 3);
+        assert(*m.begin() == 1);
+        assert(*next(m.begin()) == 2);
+        assert(*next(m.begin(), 2) == 3);
+
+        assert(mo.get_allocator() == A());
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 0);
+        assert(distance(mo.begin(), mo.end()) == 0);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,141 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set(set&& s, const allocator_type& a);
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<V> A;
+        typedef std::set<MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
+        M m3(std::move(m1), A(7));
+        assert(m3 == m2);
+        assert(m3.get_allocator() == A(7));
+        assert(m3.key_comp() == C(5));
+        assert(m1.empty());
+    }
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<V> A;
+        typedef std::set<MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
+        M m3(std::move(m1), A(5));
+        assert(m3 == m2);
+        assert(m3.get_allocator() == A(5));
+        assert(m3.key_comp() == C(5));
+        assert(m1.empty());
+    }
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef other_allocator<V> A;
+        typedef std::set<MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
+        M m3(std::move(m1), A(5));
+        assert(m3 == m2);
+        assert(m3.get_allocator() == A(5));
+        assert(m3.key_comp() == C(5));
+        assert(m1.empty());
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,186 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// set& operator=(set&& s);
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<V> A;
+        typedef std::set<MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
+        M m3(C(3), A(7));
+        m3 = std::move(m1);
+        assert(m3 == m2);
+        assert(m3.get_allocator() == A(7));
+        assert(m3.key_comp() == C(5));
+        assert(m1.empty());
+    }
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<V> A;
+        typedef std::set<MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
+        M m3(C(3), A(5));
+        m3 = std::move(m1);
+        assert(m3 == m2);
+        assert(m3.get_allocator() == A(5));
+        assert(m3.key_comp() == C(5));
+        assert(m1.empty());
+    }
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef other_allocator<V> A;
+        typedef std::set<MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7));
+        M m3(C(3), A(5));
+        m3 = std::move(m1);
+        assert(m3 == m2);
+        assert(m3.get_allocator() == A(7));
+        assert(m3.key_comp() == C(5));
+        assert(m1.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef min_allocator<V> A;
+        typedef std::set<MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+        V a2[] =
+        {
+            V(1),
+            V(1),
+            V(1),
+            V(2),
+            V(2),
+            V(2),
+            V(3),
+            V(3),
+            V(3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+        M m3(C(3), A());
+        m3 = std::move(m1);
+        assert(m3 == m2);
+        assert(m3.get_allocator() == A());
+        assert(m3.key_comp() == C(5));
+        assert(m1.empty());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// set& operator=(set&& c)
+//     noexcept(
+//          allocator_type::propagate_on_container_move_assignment::value &&
+//          is_nothrow_move_assignable<allocator_type>::value &&
+//          is_nothrow_move_assignable<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_comp
+{
+    typedef T value_type;
+    some_comp& operator=(const some_comp&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::set<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// set(set&&)
+//        noexcept(is_nothrow_move_constructible<allocator_type>::value &&
+//                 is_nothrow_move_constructible<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_comp
+{
+    typedef T value_type;
+    some_comp(const some_comp&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::set<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.special/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.special/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.special/member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,201 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// void swap(set& m);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int V;
+    typedef std::set<int> M;
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        m1.swap(m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,177 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// void swap(set& m);
+
+#include <set>
+#include <cassert>
+#include "test_allocator.h"
+#include "../../../test_compare.h"
+
+int main()
+{
+    typedef int V;
+    typedef std::set<int> M;
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+    }
+    {
+        typedef test_allocator<V> A;
+        typedef test_compare<std::less<int> > C;
+        typedef std::set<int, C, A> M;
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+        assert(m1.key_comp() == C(2));
+        assert(m1.get_allocator() == A(1));
+        assert(m2.key_comp() == C(1));
+        assert(m2.get_allocator() == A(2));
+    }
+    {
+        typedef other_allocator<V> A;
+        typedef test_compare<std::less<int> > C;
+        typedef std::set<int, C, A> M;
+        V ar1[] =
+        {
+            1,
+            2,
+            3,
+            4
+        };
+        V ar2[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+        M m1_save = m1;
+        M m2_save = m2;
+        swap(m1, m2);
+        assert(m1 == m2_save);
+        assert(m2 == m1_save);
+        assert(m1.key_comp() == C(2));
+        assert(m1.get_allocator() == A(2));
+        assert(m2.key_comp() == C(1));
+        assert(m2.get_allocator() == A(1));
+    }
+}

Added: libcxx/trunk/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// void swap(set& c)
+//     noexcept(!allocator_type::propagate_on_container_swap::value ||
+//              __is_nothrow_swappable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <set>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_comp
+{
+    typedef T value_type;
+    
+    some_comp() {}
+    some_comp(const some_comp&) {}
+    void deallocate(void*, unsigned) {}
+
+    typedef std::true_type propagate_on_container_swap;
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::set<MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
+        C c1, c2;
+        static_assert(!noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+// size_type size() const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::set<int> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1));
+    assert(m.size() == 2);
+    m.insert(M::value_type(3));
+    assert(m.size() == 3);
+    m.erase(m.begin());
+    assert(m.size() == 2);
+    m.erase(m.begin());
+    assert(m.size() == 1);
+    m.erase(m.begin());
+    assert(m.size() == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1));
+    assert(m.size() == 2);
+    m.insert(M::value_type(3));
+    assert(m.size() == 3);
+    m.erase(m.begin());
+    assert(m.size() == 2);
+    m.erase(m.begin());
+    assert(m.size() == 1);
+    m.erase(m.begin());
+    assert(m.size() == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// template <class Key, class Compare = less<Key>,
+//           class Allocator = allocator<Key>>
+// class set
+// {
+// public:
+//     // types:
+//     typedef Key                                      key_type;
+//     typedef key_type                                 value_type;
+//     typedef Compare                                  key_compare;
+//     typedef key_compare                              value_compare;
+//     typedef Allocator                                allocator_type;
+//     typedef typename allocator_type::reference       reference;
+//     typedef typename allocator_type::const_reference const_reference;
+//     typedef typename allocator_type::pointer         pointer;
+//     typedef typename allocator_type::const_pointer   const_pointer;
+//     typedef typename allocator_type::size_type       size_type;
+//     typedef typename allocator_type::difference_type difference_type;
+//     ...
+// };
+
+#include <set>
+#include <type_traits>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::set<int> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::value_type, int>::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::value_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), "");
+    static_assert((std::is_same<C::reference, int&>::value), "");
+    static_assert((std::is_same<C::const_reference, const int&>::value), "");
+    static_assert((std::is_same<C::pointer, int*>::value), "");
+    static_assert((std::is_same<C::const_pointer, const int*>::value), "");
+    static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+    static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::set<int, std::less<int>, min_allocator<int>> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::value_type, int>::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::value_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
+    static_assert((std::is_same<C::reference, int&>::value), "");
+    static_assert((std::is_same<C::const_reference, const int&>::value), "");
+    static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
+    static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
+//  min_allocator doesn't have a size_type, so one gets synthesized
+    static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
+    static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/upper_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/upper_bound.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/upper_bound.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/upper_bound.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,336 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+
+//       iterator upper_bound(const key_type& k);
+// const_iterator upper_bound(const key_type& k) const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef int V;
+    typedef std::set<int> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(5);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(13);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(15);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(17);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(19);
+        assert(r == next(m.begin(), 8));
+        r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(5);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(13);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(15);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(17);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(19);
+        assert(r == next(m.begin(), 8));
+        r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::set<int, std::less<int>, min_allocator<int>> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(5);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(13);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(15);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(17);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(19);
+        assert(r == next(m.begin(), 8));
+        r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    {
+        typedef M::const_iterator R;
+        V ar[] =
+        {
+            5,
+            7,
+            9,
+            11,
+            13,
+            15,
+            17,
+            19
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.upper_bound(5);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(7);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(9);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(11);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(13);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(15);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(17);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(19);
+        assert(r == next(m.begin(), 8));
+        r = m.upper_bound(4);
+        assert(r == next(m.begin(), 0));
+        r = m.upper_bound(6);
+        assert(r == next(m.begin(), 1));
+        r = m.upper_bound(8);
+        assert(r == next(m.begin(), 2));
+        r = m.upper_bound(10);
+        assert(r == next(m.begin(), 3));
+        r = m.upper_bound(12);
+        assert(r == next(m.begin(), 4));
+        r = m.upper_bound(14);
+        assert(r == next(m.begin(), 5));
+        r = m.upper_bound(16);
+        assert(r == next(m.begin(), 6));
+        r = m.upper_bound(18);
+        assert(r == next(m.begin(), 7));
+        r = m.upper_bound(20);
+        assert(r == next(m.begin(), 8));
+    }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::set<V, std::less<>> M;
+    typedef M::iterator R;
+
+    V ar[] =
+    {
+        5,
+        7,
+        9,
+        11,
+        13,
+        15,
+        17,
+        19
+    };
+    M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.upper_bound(5);
+    assert(r == next(m.begin(), 1));
+    r = m.upper_bound(7);
+    assert(r == next(m.begin(), 2));
+    r = m.upper_bound(9);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(11);
+    assert(r == next(m.begin(), 4));
+    r = m.upper_bound(13);
+    assert(r == next(m.begin(), 5));
+    r = m.upper_bound(15);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(17);
+    assert(r == next(m.begin(), 7));
+    r = m.upper_bound(19);
+    assert(r == next(m.begin(), 8));
+    r = m.upper_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.upper_bound(6);
+    assert(r == next(m.begin(), 1));
+    r = m.upper_bound(8);
+    assert(r == next(m.begin(), 2));
+    r = m.upper_bound(10);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(12);
+    assert(r == next(m.begin(), 4));
+    r = m.upper_bound(14);
+    assert(r == next(m.begin(), 5));
+    r = m.upper_bound(16);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(18);
+    assert(r == next(m.begin(), 7));
+    r = m.upper_bound(20);
+    assert(r == next(m.begin(), 8));
+    }
+    
+    {
+    typedef PrivateConstructor V;
+    typedef std::set<V, std::less<>> M;
+    typedef M::iterator R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 11 ));
+    m.insert ( V::make ( 13 ));
+    m.insert ( V::make ( 15 ));
+    m.insert ( V::make ( 17 ));
+    m.insert ( V::make ( 19 ));
+
+    R r = m.upper_bound(5);
+    assert(r == next(m.begin(), 1));
+    r = m.upper_bound(7);
+    assert(r == next(m.begin(), 2));
+    r = m.upper_bound(9);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(11);
+    assert(r == next(m.begin(), 4));
+    r = m.upper_bound(13);
+    assert(r == next(m.begin(), 5));
+    r = m.upper_bound(15);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(17);
+    assert(r == next(m.begin(), 7));
+    r = m.upper_bound(19);
+    assert(r == next(m.begin(), 8));
+    r = m.upper_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.upper_bound(6);
+    assert(r == next(m.begin(), 1));
+    r = m.upper_bound(8);
+    assert(r == next(m.begin(), 2));
+    r = m.upper_bound(10);
+    assert(r == next(m.begin(), 3));
+    r = m.upper_bound(12);
+    assert(r == next(m.begin(), 4));
+    r = m.upper_bound(14);
+    assert(r == next(m.begin(), 5));
+    r = m.upper_bound(16);
+    assert(r == next(m.begin(), 6));
+    r = m.upper_bound(18);
+    assert(r == next(m.begin(), 7));
+    r = m.upper_bound(20);
+    assert(r == next(m.begin(), 8));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/set/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/version.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/set/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+#include <set>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/associative/tree_balance_after_insert.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/tree_balance_after_insert.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/tree_balance_after_insert.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/tree_balance_after_insert.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,1616 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Precondition:  __root->__is_black_ == true
+// template <class _NodePtr>
+// void
+// __tree_balance_after_insert(_NodePtr __root, _NodePtr __x)
+
+#include <__tree>
+#include <cassert>
+
+struct Node
+{
+    Node* __left_;
+    Node* __right_;
+    Node* __parent_;
+    bool __is_black_;
+
+    Node() : __left_(), __right_(), __parent_(), __is_black_() {}
+};
+
+void
+test1()
+{
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = &a;
+        b.__right_ = 0;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = 0;
+        d.__right_ = 0;
+        d.__is_black_ = false;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == 0);
+        assert(d.__right_ == 0);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = 0;
+        b.__right_ = &a;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = 0;
+        d.__right_ = 0;
+        d.__is_black_ = false;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == &a);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == 0);
+        assert(d.__right_ == 0);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = 0;
+        b.__right_ = 0;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = &a;
+        d.__right_ = 0;
+        d.__is_black_ = false;
+
+        a.__parent_ = &d;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == &a);
+        assert(d.__right_ == 0);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &d);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = 0;
+        b.__right_ = 0;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = 0;
+        d.__right_ = &a;
+        d.__is_black_ = false;
+
+        a.__parent_ = &d;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == 0);
+        assert(d.__right_ == &a);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &d);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+        Node h;
+        Node i;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = &a;
+        b.__right_ = &g;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = &h;
+        d.__right_ = &i;
+        d.__is_black_ = false;
+
+        a.__parent_ = &b;
+        a.__left_ = &e;
+        a.__right_ = &f;
+        a.__is_black_ = false;
+
+        e.__parent_ = &a;
+        e.__is_black_ = true;
+
+        f.__parent_ = &a;
+        f.__is_black_ = true;
+
+        g.__parent_ = &b;
+        g.__is_black_ = true;
+
+        h.__parent_ = &d;
+        h.__is_black_ = true;
+
+        i.__parent_ = &d;
+        i.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &g);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == &h);
+        assert(d.__right_ == &i);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == &e);
+        assert(a.__right_ == &f);
+        assert(a.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+        Node h;
+        Node i;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = &g;
+        b.__right_ = &a;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = &h;
+        d.__right_ = &i;
+        d.__is_black_ = false;
+
+        a.__parent_ = &b;
+        a.__left_ = &e;
+        a.__right_ = &f;
+        a.__is_black_ = false;
+
+        e.__parent_ = &a;
+        e.__is_black_ = true;
+
+        f.__parent_ = &a;
+        f.__is_black_ = true;
+
+        g.__parent_ = &b;
+        g.__is_black_ = true;
+
+        h.__parent_ = &d;
+        h.__is_black_ = true;
+
+        i.__parent_ = &d;
+        i.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == &g);
+        assert(b.__right_ == &a);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == &h);
+        assert(d.__right_ == &i);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == &e);
+        assert(a.__right_ == &f);
+        assert(a.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+        Node h;
+        Node i;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = &g;
+        b.__right_ = &h;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = &a;
+        d.__right_ = &i;
+        d.__is_black_ = false;
+
+        a.__parent_ = &d;
+        a.__left_ = &e;
+        a.__right_ = &f;
+        a.__is_black_ = false;
+
+        e.__parent_ = &a;
+        e.__is_black_ = true;
+
+        f.__parent_ = &a;
+        f.__is_black_ = true;
+
+        g.__parent_ = &b;
+        g.__is_black_ = true;
+
+        h.__parent_ = &b;
+        h.__is_black_ = true;
+
+        i.__parent_ = &d;
+        i.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == &g);
+        assert(b.__right_ == &h);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == &a);
+        assert(d.__right_ == &i);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &d);
+        assert(a.__left_ == &e);
+        assert(a.__right_ == &f);
+        assert(a.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+        Node h;
+        Node i;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &d;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = &g;
+        b.__right_ = &h;
+        b.__is_black_ = false;
+
+        d.__parent_ = &c;
+        d.__left_ = &i;
+        d.__right_ = &a;
+        d.__is_black_ = false;
+
+        a.__parent_ = &d;
+        a.__left_ = &e;
+        a.__right_ = &f;
+        a.__is_black_ = false;
+
+        e.__parent_ = &a;
+        e.__is_black_ = true;
+
+        f.__parent_ = &a;
+        f.__is_black_ = true;
+
+        g.__parent_ = &b;
+        g.__is_black_ = true;
+
+        h.__parent_ = &b;
+        h.__is_black_ = true;
+
+        i.__parent_ = &d;
+        i.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &c);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &b);
+        assert(c.__right_ == &d);
+        assert(c.__is_black_ == true);
+
+        assert(b.__parent_ == &c);
+        assert(b.__left_ == &g);
+        assert(b.__right_ == &h);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &c);
+        assert(d.__left_ == &i);
+        assert(d.__right_ == &a);
+        assert(d.__is_black_ == true);
+
+        assert(a.__parent_ == &d);
+        assert(a.__left_ == &e);
+        assert(a.__right_ == &f);
+        assert(a.__is_black_ == false);
+    }
+}
+
+void
+test2()
+{
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &a;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        a.__parent_ = &c;
+        a.__left_ = 0;
+        a.__right_ = &b;
+        a.__is_black_ = false;
+
+        b.__parent_ = &a;
+        b.__left_ = 0;
+        b.__right_ = 0;
+        b.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &a;
+
+        a.__parent_ = &root;
+        a.__left_ = 0;
+        a.__right_ = &c;
+        a.__is_black_ = true;
+
+        c.__parent_ = &a;
+        c.__left_ = &b;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        b.__parent_ = &c;
+        b.__left_ = 0;
+        b.__right_ = 0;
+        b.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &a;
+        c.__right_ = &g;
+        c.__is_black_ = true;
+
+        a.__parent_ = &c;
+        a.__left_ = &d;
+        a.__right_ = &b;
+        a.__is_black_ = false;
+
+        b.__parent_ = &a;
+        b.__left_ = &e;
+        b.__right_ = &f;
+        b.__is_black_ = false;
+
+        d.__parent_ = &a;
+        d.__is_black_ = true;
+
+        e.__parent_ = &b;
+        e.__is_black_ = true;
+
+        f.__parent_ = &b;
+        f.__is_black_ = true;
+
+        g.__parent_ = &c;
+        g.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == &f);
+        assert(c.__right_ == &g);
+        assert(c.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == &d);
+        assert(a.__right_ == &e);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &a);
+        assert(d.__is_black_ == true);
+
+        assert(e.__parent_ == &a);
+        assert(e.__is_black_ == true);
+
+        assert(f.__parent_ == &c);
+        assert(f.__is_black_ == true);
+
+        assert(g.__parent_ == &c);
+        assert(g.__is_black_ == true);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+
+        root.__left_ = &a;
+
+        a.__parent_ = &root;
+        a.__left_ = &d;
+        a.__right_ = &c;
+        a.__is_black_ = true;
+
+        c.__parent_ = &a;
+        c.__left_ = &b;
+        c.__right_ = &g;
+        c.__is_black_ = false;
+
+        b.__parent_ = &c;
+        b.__left_ = &e;
+        b.__right_ = &f;
+        b.__is_black_ = false;
+
+        d.__parent_ = &a;
+        d.__is_black_ = true;
+
+        e.__parent_ = &b;
+        e.__is_black_ = true;
+
+        f.__parent_ = &b;
+        f.__is_black_ = true;
+
+        g.__parent_ = &c;
+        g.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == &f);
+        assert(c.__right_ == &g);
+        assert(c.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == &d);
+        assert(a.__right_ == &e);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &a);
+        assert(d.__is_black_ == true);
+
+        assert(e.__parent_ == &a);
+        assert(e.__is_black_ == true);
+
+        assert(f.__parent_ == &c);
+        assert(f.__is_black_ == true);
+
+        assert(g.__parent_ == &c);
+        assert(g.__is_black_ == true);
+    }
+}
+
+void
+test3()
+{
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = &a;
+        b.__right_ = 0;
+        b.__is_black_ = false;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &a;
+
+        a.__parent_ = &root;
+        a.__left_ = 0;
+        a.__right_ = &b;
+        a.__is_black_ = true;
+
+        b.__parent_ = &a;
+        b.__left_ = 0;
+        b.__right_ = &c;
+        b.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        std::__tree_balance_after_insert(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+
+        root.__left_ = &c;
+
+        c.__parent_ = &root;
+        c.__left_ = &b;
+        c.__right_ = &g;
+        c.__is_black_ = true;
+
+        b.__parent_ = &c;
+        b.__left_ = &a;
+        b.__right_ = &f;
+        b.__is_black_ = false;
+
+        a.__parent_ = &b;
+        a.__left_ = &d;
+        a.__right_ = &e;
+        a.__is_black_ = false;
+
+        d.__parent_ = &a;
+        d.__is_black_ = true;
+
+        e.__parent_ = &a;
+        e.__is_black_ = true;
+
+        f.__parent_ = &b;
+        f.__is_black_ = true;
+
+        g.__parent_ = &c;
+        g.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == &f);
+        assert(c.__right_ == &g);
+        assert(c.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == &d);
+        assert(a.__right_ == &e);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &a);
+        assert(d.__is_black_ == true);
+
+        assert(e.__parent_ == &a);
+        assert(e.__is_black_ == true);
+
+        assert(f.__parent_ == &c);
+        assert(f.__is_black_ == true);
+
+        assert(g.__parent_ == &c);
+        assert(g.__is_black_ == true);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node g;
+
+        root.__left_ = &a;
+
+        a.__parent_ = &root;
+        a.__left_ = &d;
+        a.__right_ = &b;
+        a.__is_black_ = true;
+
+        b.__parent_ = &a;
+        b.__left_ = &e;
+        b.__right_ = &c;
+        b.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = &f;
+        c.__right_ = &g;
+        c.__is_black_ = false;
+
+        d.__parent_ = &a;
+        d.__is_black_ = true;
+
+        e.__parent_ = &b;
+        e.__is_black_ = true;
+
+        f.__parent_ = &c;
+        f.__is_black_ = true;
+
+        g.__parent_ = &c;
+        g.__is_black_ = true;
+
+        std::__tree_balance_after_insert(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__left_ == &b);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == &f);
+        assert(c.__right_ == &g);
+        assert(c.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == &d);
+        assert(a.__right_ == &e);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(d.__parent_ == &a);
+        assert(d.__is_black_ == true);
+
+        assert(e.__parent_ == &a);
+        assert(e.__is_black_ == true);
+
+        assert(f.__parent_ == &c);
+        assert(f.__is_black_ == true);
+
+        assert(g.__parent_ == &c);
+        assert(g.__is_black_ == true);
+    }
+}
+
+void
+test4()
+{
+    Node root;
+    Node a;
+    Node b;
+    Node c;
+    Node d;
+    Node e;
+    Node f;
+    Node g;
+    Node h;
+
+    root.__left_ = &a;
+    a.__parent_ = &root;
+
+    std::__tree_balance_after_insert(root.__left_, &a);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &a);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(a.__parent_ == &root);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    a.__right_ = &b;
+    b.__parent_ = &a;
+
+    std::__tree_balance_after_insert(root.__left_, &b);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &a);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(a.__parent_ == &root);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == &b);
+    assert(a.__is_black_ == true);
+
+    assert(b.__parent_ == &a);
+    assert(b.__left_ == 0);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == false);
+
+    b.__right_ = &c;
+    c.__parent_ = &b;
+
+    std::__tree_balance_after_insert(root.__left_, &c);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &b);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == false);
+
+    assert(b.__parent_ == &root);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == &c);
+    assert(b.__is_black_ == true);
+
+    assert(c.__parent_ == &b);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == false);
+
+    c.__right_ = &d;
+    d.__parent_ = &c;
+
+    std::__tree_balance_after_insert(root.__left_, &d);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &b);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    assert(b.__parent_ == &root);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == &c);
+    assert(b.__is_black_ == true);
+
+    assert(c.__parent_ == &b);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == &d);
+    assert(c.__is_black_ == true);
+
+    assert(d.__parent_ == &c);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == false);
+
+    d.__right_ = &e;
+    e.__parent_ = &d;
+
+    std::__tree_balance_after_insert(root.__left_, &e);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &b);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(b.__parent_ == &root);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == &d);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    assert(d.__parent_ == &b);
+    assert(d.__left_ == &c);
+    assert(d.__right_ == &e);
+    assert(d.__is_black_ == true);
+
+    assert(c.__parent_ == &d);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == false);
+
+    assert(e.__parent_ == &d);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == false);
+
+    e.__right_ = &f;
+    f.__parent_ = &e;
+
+    std::__tree_balance_after_insert(root.__left_, &f);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &b);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(b.__parent_ == &root);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == &d);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    assert(d.__parent_ == &b);
+    assert(d.__left_ == &c);
+    assert(d.__right_ == &e);
+    assert(d.__is_black_ == false);
+
+    assert(c.__parent_ == &d);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == true);
+
+    assert(e.__parent_ == &d);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == &f);
+    assert(e.__is_black_ == true);
+
+    assert(f.__parent_ == &e);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == false);
+
+    f.__right_ = &g;
+    g.__parent_ = &f;
+
+    std::__tree_balance_after_insert(root.__left_, &g);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &b);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(b.__parent_ == &root);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == &d);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    assert(d.__parent_ == &b);
+    assert(d.__left_ == &c);
+    assert(d.__right_ == &f);
+    assert(d.__is_black_ == false);
+
+    assert(c.__parent_ == &d);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == true);
+
+    assert(f.__parent_ == &d);
+    assert(f.__left_ == &e);
+    assert(f.__right_ == &g);
+    assert(f.__is_black_ == true);
+
+    assert(e.__parent_ == &f);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == false);
+
+    assert(g.__parent_ == &f);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == 0);
+    assert(g.__is_black_ == false);
+
+    g.__right_ = &h;
+    h.__parent_ = &g;
+
+    std::__tree_balance_after_insert(root.__left_, &h);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &d);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(d.__parent_ == &root);
+    assert(d.__left_ == &b);
+    assert(d.__right_ == &f);
+    assert(d.__is_black_ == true);
+
+    assert(b.__parent_ == &d);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == &c);
+    assert(b.__is_black_ == false);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    assert(c.__parent_ == &b);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == true);
+
+    assert(f.__parent_ == &d);
+    assert(f.__left_ == &e);
+    assert(f.__right_ == &g);
+    assert(f.__is_black_ == false);
+
+    assert(e.__parent_ == &f);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == true);
+
+    assert(g.__parent_ == &f);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == false);
+}
+
+void
+test5()
+{
+    Node root;
+    Node a;
+    Node b;
+    Node c;
+    Node d;
+    Node e;
+    Node f;
+    Node g;
+    Node h;
+
+    root.__left_ = &h;
+    h.__parent_ = &root;
+
+    std::__tree_balance_after_insert(root.__left_, &h);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &h);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(h.__parent_ == &root);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    h.__left_ = &g;
+    g.__parent_ = &h;
+
+    std::__tree_balance_after_insert(root.__left_, &g);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &h);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(h.__parent_ == &root);
+    assert(h.__left_ == &g);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    assert(g.__parent_ == &h);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == 0);
+    assert(g.__is_black_ == false);
+
+    g.__left_ = &f;
+    f.__parent_ = &g;
+
+    std::__tree_balance_after_insert(root.__left_, &f);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &g);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(g.__parent_ == &root);
+    assert(g.__left_ == &f);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(f.__parent_ == &g);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == false);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == false);
+
+    f.__left_ = &e;
+    e.__parent_ = &f;
+
+    std::__tree_balance_after_insert(root.__left_, &e);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &g);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(g.__parent_ == &root);
+    assert(g.__left_ == &f);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(f.__parent_ == &g);
+    assert(f.__left_ == &e);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == true);
+
+    assert(e.__parent_ == &f);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == false);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    e.__left_ = &d;
+    d.__parent_ = &e;
+
+    std::__tree_balance_after_insert(root.__left_, &d);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &g);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(g.__parent_ == &root);
+    assert(g.__left_ == &e);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(e.__parent_ == &g);
+    assert(e.__left_ == &d);
+    assert(e.__right_ == &f);
+    assert(e.__is_black_ == true);
+
+    assert(d.__parent_ == &e);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == false);
+
+    assert(f.__parent_ == &e);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == false);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    d.__left_ = &c;
+    c.__parent_ = &d;
+
+    std::__tree_balance_after_insert(root.__left_, &c);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &g);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(g.__parent_ == &root);
+    assert(g.__left_ == &e);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(e.__parent_ == &g);
+    assert(e.__left_ == &d);
+    assert(e.__right_ == &f);
+    assert(e.__is_black_ == false);
+
+    assert(d.__parent_ == &e);
+    assert(d.__left_ == &c);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == true);
+
+    assert(c.__parent_ == &d);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == false);
+
+    assert(f.__parent_ == &e);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    c.__left_ = &b;
+    b.__parent_ = &c;
+
+    std::__tree_balance_after_insert(root.__left_, &b);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &g);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(g.__parent_ == &root);
+    assert(g.__left_ == &e);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(e.__parent_ == &g);
+    assert(e.__left_ == &c);
+    assert(e.__right_ == &f);
+    assert(e.__is_black_ == false);
+
+    assert(c.__parent_ == &e);
+    assert(c.__left_ == &b);
+    assert(c.__right_ == &d);
+    assert(c.__is_black_ == true);
+
+    assert(b.__parent_ == &c);
+    assert(b.__left_ == 0);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == false);
+
+    assert(d.__parent_ == &c);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == false);
+
+    assert(f.__parent_ == &e);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    b.__left_ = &a;
+    a.__parent_ = &b;
+
+    std::__tree_balance_after_insert(root.__left_, &a);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &e);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(e.__parent_ == &root);
+    assert(e.__left_ == &c);
+    assert(e.__right_ == &g);
+    assert(e.__is_black_ == true);
+
+    assert(c.__parent_ == &e);
+    assert(c.__left_ == &b);
+    assert(c.__right_ == &d);
+    assert(c.__is_black_ == false);
+
+    assert(b.__parent_ == &c);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == false);
+
+    assert(d.__parent_ == &c);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == true);
+
+    assert(g.__parent_ == &e);
+    assert(g.__left_ == &f);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == false);
+
+    assert(f.__parent_ == &g);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+}
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+    test5();
+}

Added: libcxx/trunk/test/std/containers/associative/tree_left_rotate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/tree_left_rotate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/tree_left_rotate.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/tree_left_rotate.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Precondition:  __x->__right_ != nullptr
+// template <class _NodePtr>
+// void
+// __tree_left_rotate(_NodePtr __x);
+
+#include <__tree>
+#include <cassert>
+
+struct Node
+{
+    Node* __left_;
+    Node* __right_;
+    Node* __parent_;
+
+    Node() : __left_(), __right_(), __parent_() {}
+};
+
+void
+test1()
+{
+    Node root;
+    Node x;
+    Node y;
+    root.__left_ = &x;
+    x.__left_ = 0;
+    x.__right_ = &y;
+    x.__parent_ = &root;
+    y.__left_ = 0;
+    y.__right_ = 0;
+    y.__parent_ = &x;
+    std::__tree_left_rotate(&x);
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &y);
+    assert(root.__right_ == 0);
+    assert(y.__parent_ == &root);
+    assert(y.__left_ == &x);
+    assert(y.__right_ == 0);
+    assert(x.__parent_ == &y);
+    assert(x.__left_ == 0);
+    assert(x.__right_ == 0);
+}
+
+void
+test2()
+{
+    Node root;
+    Node x;
+    Node y;
+    Node a;
+    Node b;
+    Node c;
+    root.__left_ = &x;
+    x.__left_ = &a;
+    x.__right_ = &y;
+    x.__parent_ = &root;
+    y.__left_ = &b;
+    y.__right_ = &c;
+    y.__parent_ = &x;
+    a.__parent_ = &x;
+    b.__parent_ = &y;
+    c.__parent_ = &y;
+    std::__tree_left_rotate(&x);
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &y);
+    assert(root.__right_ == 0);
+    assert(y.__parent_ == &root);
+    assert(y.__left_ == &x);
+    assert(y.__right_ == &c);
+    assert(x.__parent_ == &y);
+    assert(x.__left_ == &a);
+    assert(x.__right_ == &b);
+    assert(a.__parent_ == &x);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(b.__parent_ == &x);
+    assert(b.__left_ == 0);
+    assert(b.__right_ == 0);
+    assert(c.__parent_ == &y);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+}
+
+int main()
+{
+    test1();
+    test2();
+}

Added: libcxx/trunk/test/std/containers/associative/tree_remove.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/tree_remove.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/tree_remove.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/tree_remove.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,1648 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Returns __tree_next(__z)
+// template <class _NodePtr>
+// void
+// __tree_remove(_NodePtr __root, _NodePtr __z)
+
+#include <__tree>
+#include <cassert>
+
+struct Node
+{
+    Node* __left_;
+    Node* __right_;
+    Node* __parent_;
+    bool __is_black_;
+
+    Node() : __left_(), __right_(), __parent_(), __is_black_() {}
+};
+
+void
+test1()
+{
+    {
+        // Left
+        // Case 1 -> Case 2 -> x is red turned to black
+        Node root;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node y;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &y;
+        b.__right_ = &d;
+        b.__is_black_ = true;
+
+        y.__parent_ = &b;
+        y.__left_ = 0;
+        y.__right_ = 0;
+        y.__is_black_ = true;
+
+        d.__parent_ = &b;
+        d.__left_ = &c;
+        d.__right_ = &e;
+        d.__is_black_ = false;
+
+        c.__parent_ = &d;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        e.__parent_ = &d;
+        e.__left_ = 0;
+        e.__right_ = 0;
+        e.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &y);
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &d);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(d.__parent_ == &root);
+        assert(d.__left_ == &b);
+        assert(d.__right_ == &e);
+        assert(d.__is_black_ == true);
+
+        assert(b.__parent_ == &d);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        assert(e.__parent_ == &d);
+        assert(e.__left_ == 0);
+        assert(e.__right_ == 0);
+        assert(e.__is_black_ == true);
+    }
+    {
+        // Right
+        // Case 1 -> Case 2 -> x is red turned to black
+        Node root;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node y;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__right_ = &y;
+        b.__left_ = &d;
+        b.__is_black_ = true;
+
+        y.__parent_ = &b;
+        y.__right_ = 0;
+        y.__left_ = 0;
+        y.__is_black_ = true;
+
+        d.__parent_ = &b;
+        d.__right_ = &c;
+        d.__left_ = &e;
+        d.__is_black_ = false;
+
+        c.__parent_ = &d;
+        c.__right_ = 0;
+        c.__left_ = 0;
+        c.__is_black_ = true;
+
+        e.__parent_ = &d;
+        e.__right_ = 0;
+        e.__left_ = 0;
+        e.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &y);
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &d);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(d.__parent_ == &root);
+        assert(d.__right_ == &b);
+        assert(d.__left_ == &e);
+        assert(d.__is_black_ == true);
+
+        assert(b.__parent_ == &d);
+        assert(b.__right_ == 0);
+        assert(b.__left_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &b);
+        assert(c.__right_ == 0);
+        assert(c.__left_ == 0);
+        assert(c.__is_black_ == false);
+
+        assert(e.__parent_ == &d);
+        assert(e.__right_ == 0);
+        assert(e.__left_ == 0);
+        assert(e.__is_black_ == true);
+    }
+    {
+        // Left
+        // Case 1 -> Case 3 -> Case 4
+        Node root;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node y;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &y;
+        b.__right_ = &d;
+        b.__is_black_ = true;
+
+        y.__parent_ = &b;
+        y.__left_ = 0;
+        y.__right_ = 0;
+        y.__is_black_ = true;
+
+        d.__parent_ = &b;
+        d.__left_ = &c;
+        d.__right_ = &e;
+        d.__is_black_ = false;
+
+        c.__parent_ = &d;
+        c.__left_ = &f;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        e.__parent_ = &d;
+        e.__left_ = 0;
+        e.__right_ = 0;
+        e.__is_black_ = true;
+
+        f.__parent_ = &c;
+        f.__left_ = 0;
+        f.__right_ = 0;
+        f.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &y);
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &d);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(d.__parent_ == &root);
+        assert(d.__left_ == &f);
+        assert(d.__right_ == &e);
+        assert(d.__is_black_ == true);
+
+        assert(f.__parent_ == &d);
+        assert(f.__left_ == &b);
+        assert(f.__right_ == &c);
+        assert(f.__is_black_ == false);
+
+        assert(b.__parent_ == &f);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &f);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        assert(e.__parent_ == &d);
+        assert(e.__left_ == 0);
+        assert(e.__right_ == 0);
+        assert(e.__is_black_ == true);
+    }
+    {
+        // Right
+        // Case 1 -> Case 3 -> Case 4
+        Node root;
+        Node b;
+        Node c;
+        Node d;
+        Node e;
+        Node f;
+        Node y;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__right_ = &y;
+        b.__left_ = &d;
+        b.__is_black_ = true;
+
+        y.__parent_ = &b;
+        y.__right_ = 0;
+        y.__left_ = 0;
+        y.__is_black_ = true;
+
+        d.__parent_ = &b;
+        d.__right_ = &c;
+        d.__left_ = &e;
+        d.__is_black_ = false;
+
+        c.__parent_ = &d;
+        c.__right_ = &f;
+        c.__left_ = 0;
+        c.__is_black_ = true;
+
+        e.__parent_ = &d;
+        e.__right_ = 0;
+        e.__left_ = 0;
+        e.__is_black_ = true;
+
+        f.__parent_ = &c;
+        f.__right_ = 0;
+        f.__left_ = 0;
+        f.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &y);
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &d);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(d.__parent_ == &root);
+        assert(d.__right_ == &f);
+        assert(d.__left_ == &e);
+        assert(d.__is_black_ == true);
+
+        assert(f.__parent_ == &d);
+        assert(f.__right_ == &b);
+        assert(f.__left_ == &c);
+        assert(f.__is_black_ == false);
+
+        assert(b.__parent_ == &f);
+        assert(b.__right_ == 0);
+        assert(b.__left_ == 0);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &f);
+        assert(c.__right_ == 0);
+        assert(c.__left_ == 0);
+        assert(c.__is_black_ == true);
+
+        assert(e.__parent_ == &d);
+        assert(e.__right_ == 0);
+        assert(e.__left_ == 0);
+        assert(e.__is_black_ == true);
+    }
+}
+
+void
+test2()
+{
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = true;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = true;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == &c);
+        assert(b.__is_black_ == true);
+
+        assert(c.__parent_ == &b);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == false);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = true;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &c);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &a);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &c);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &a);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == 0);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = true;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &c);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &a);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &a);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &root);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &c);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &c);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(c.__parent_ == &root);
+        assert(c.__left_ == &a);
+        assert(c.__right_ == 0);
+        assert(c.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &a);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &root);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = true;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &a);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &root);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &a);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &root);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = true;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = true;
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+    {
+        Node root;
+        Node a;
+        Node b;
+        Node c;
+
+        root.__left_ = &b;
+
+        b.__parent_ = &root;
+        b.__left_ = &a;
+        b.__right_ = &c;
+        b.__is_black_ = true;
+
+        a.__parent_ = &b;
+        a.__left_ = 0;
+        a.__right_ = 0;
+        a.__is_black_ = false;
+
+        c.__parent_ = &b;
+        c.__left_ = 0;
+        c.__right_ = 0;
+        c.__is_black_ = false;
+
+        std::__tree_remove(root.__left_, &c);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(a.__parent_ == &b);
+        assert(a.__left_ == 0);
+        assert(a.__right_ == 0);
+        assert(a.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == &a);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &a);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == &b);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+
+        assert(b.__parent_ == &root);
+        assert(b.__left_ == 0);
+        assert(b.__right_ == 0);
+        assert(b.__is_black_ == true);
+
+        std::__tree_remove(root.__left_, &b);
+
+        assert(std::__tree_invariant(root.__left_));
+
+        assert(root.__parent_ == 0);
+        assert(root.__left_ == 0);
+        assert(root.__right_ == 0);
+        assert(root.__is_black_ == false);
+    }
+}
+
+void
+test3()
+{
+    Node root;
+    Node a;
+    Node b;
+    Node c;
+    Node d;
+    Node e;
+    Node f;
+    Node g;
+    Node h;
+
+    root.__left_ = &e;
+
+    e.__parent_ = &root;
+    e.__left_ = &c;
+    e.__right_ = &g;
+    e.__is_black_ = true;
+
+    c.__parent_ = &e;
+    c.__left_ = &b;
+    c.__right_ = &d;
+    c.__is_black_ = false;
+
+    g.__parent_ = &e;
+    g.__left_ = &f;
+    g.__right_ = &h;
+    g.__is_black_ = false;
+
+    b.__parent_ = &c;
+    b.__left_ = &a;
+    b.__right_ = 0;
+    b.__is_black_ = true;
+
+    d.__parent_ = &c;
+    d.__left_ = 0;
+    d.__right_ = 0;
+    d.__is_black_ = true;
+
+    f.__parent_ = &g;
+    f.__left_ = 0;
+    f.__right_ = 0;
+    f.__is_black_ = true;
+
+    h.__parent_ = &g;
+    h.__left_ = 0;
+    h.__right_ = 0;
+    h.__is_black_ = true;
+
+    a.__parent_ = &b;
+    a.__left_ = 0;
+    a.__right_ = 0;
+    a.__is_black_ = false;
+
+    assert(std::__tree_invariant(root.__left_));
+
+    std::__tree_remove(root.__left_, &h);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &e);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(e.__parent_ == &root);
+    assert(e.__left_ == &c);
+    assert(e.__right_ == &g);
+    assert(e.__is_black_ == true);
+
+    assert(c.__parent_ == &e);
+    assert(c.__left_ == &b);
+    assert(c.__right_ == &d);
+    assert(c.__is_black_ == false);
+
+    assert(g.__parent_ == &e);
+    assert(g.__left_ == &f);
+    assert(g.__right_ == 0);
+    assert(g.__is_black_ == true);
+
+    assert(b.__parent_ == &c);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == false);
+
+    assert(d.__parent_ == &c);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == true);
+
+    assert(f.__parent_ == &g);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &g);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &e);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(e.__parent_ == &root);
+    assert(e.__left_ == &c);
+    assert(e.__right_ == &f);
+    assert(e.__is_black_ == true);
+
+    assert(c.__parent_ == &e);
+    assert(c.__left_ == &b);
+    assert(c.__right_ == &d);
+    assert(c.__is_black_ == false);
+
+    assert(b.__parent_ == &c);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == false);
+
+    assert(d.__parent_ == &c);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == true);
+
+    assert(f.__parent_ == &e);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == true);
+
+    std::__tree_remove(root.__left_, &f);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &c);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(c.__parent_ == &root);
+    assert(c.__left_ == &b);
+    assert(c.__right_ == &e);
+    assert(c.__is_black_ == true);
+
+    assert(b.__parent_ == &c);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == true);
+
+    assert(e.__parent_ == &c);
+    assert(e.__left_ == &d);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == false);
+
+    assert(d.__parent_ == &e);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &e);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &c);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(c.__parent_ == &root);
+    assert(c.__left_ == &b);
+    assert(c.__right_ == &d);
+    assert(c.__is_black_ == true);
+
+    assert(b.__parent_ == &c);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == false);
+
+    assert(d.__parent_ == &c);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == 0);
+    assert(d.__is_black_ == true);
+
+    std::__tree_remove(root.__left_, &d);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &b);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(b.__parent_ == &root);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == &c);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    assert(c.__parent_ == &b);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == true);
+
+    std::__tree_remove(root.__left_, &c);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &b);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(b.__parent_ == &root);
+    assert(b.__left_ == &a);
+    assert(b.__right_ == 0);
+    assert(b.__is_black_ == true);
+
+    assert(a.__parent_ == &b);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &b);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &a);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(a.__parent_ == &root);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(a.__is_black_ == true);
+
+    std::__tree_remove(root.__left_, &a);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == 0);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+}
+
+void
+test4()
+{
+    Node root;
+    Node a;
+    Node b;
+    Node c;
+    Node d;
+    Node e;
+    Node f;
+    Node g;
+    Node h;
+
+    root.__left_ = &d;
+
+    d.__parent_ = &root;
+    d.__left_ = &b;
+    d.__right_ = &f;
+    d.__is_black_ = true;
+
+    b.__parent_ = &d;
+    b.__left_ = &a;
+    b.__right_ = &c;
+    b.__is_black_ = false;
+
+    f.__parent_ = &d;
+    f.__left_ = &e;
+    f.__right_ = &g;
+    f.__is_black_ = false;
+
+    a.__parent_ = &b;
+    a.__left_ = 0;
+    a.__right_ = 0;
+    a.__is_black_ = true;
+
+    c.__parent_ = &b;
+    c.__left_ = 0;
+    c.__right_ = 0;
+    c.__is_black_ = true;
+
+    e.__parent_ = &f;
+    e.__left_ = 0;
+    e.__right_ = 0;
+    e.__is_black_ = true;
+
+    g.__parent_ = &f;
+    g.__left_ = 0;
+    g.__right_ = &h;
+    g.__is_black_ = true;
+
+    h.__parent_ = &g;
+    h.__left_ = 0;
+    h.__right_ = 0;
+    h.__is_black_ = false;
+
+    assert(std::__tree_invariant(root.__left_));
+
+    std::__tree_remove(root.__left_, &a);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &d);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(d.__parent_ == &root);
+    assert(d.__left_ == &b);
+    assert(d.__right_ == &f);
+    assert(d.__is_black_ == true);
+
+    assert(b.__parent_ == &d);
+    assert(b.__left_ == 0);
+    assert(b.__right_ == &c);
+    assert(b.__is_black_ == true);
+
+    assert(f.__parent_ == &d);
+    assert(f.__left_ == &e);
+    assert(f.__right_ == &g);
+    assert(f.__is_black_ == false);
+
+    assert(c.__parent_ == &b);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == false);
+
+    assert(e.__parent_ == &f);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == true);
+
+    assert(g.__parent_ == &f);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &b);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &d);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(d.__parent_ == &root);
+    assert(d.__left_ == &c);
+    assert(d.__right_ == &f);
+    assert(d.__is_black_ == true);
+
+    assert(c.__parent_ == &d);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+    assert(c.__is_black_ == true);
+
+    assert(f.__parent_ == &d);
+    assert(f.__left_ == &e);
+    assert(f.__right_ == &g);
+    assert(f.__is_black_ == false);
+
+    assert(e.__parent_ == &f);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == true);
+
+    assert(g.__parent_ == &f);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &c);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &f);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(f.__parent_ == &root);
+    assert(f.__left_ == &d);
+    assert(f.__right_ == &g);
+    assert(f.__is_black_ == true);
+
+    assert(d.__parent_ == &f);
+    assert(d.__left_ == 0);
+    assert(d.__right_ == &e);
+    assert(d.__is_black_ == true);
+
+    assert(g.__parent_ == &f);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(e.__parent_ == &d);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == false);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &d);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &f);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(f.__parent_ == &root);
+    assert(f.__left_ == &e);
+    assert(f.__right_ == &g);
+    assert(f.__is_black_ == true);
+
+    assert(e.__parent_ == &f);
+    assert(e.__left_ == 0);
+    assert(e.__right_ == 0);
+    assert(e.__is_black_ == true);
+
+    assert(g.__parent_ == &f);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &e);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &g);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(g.__parent_ == &root);
+    assert(g.__left_ == &f);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(f.__parent_ == &g);
+    assert(f.__left_ == 0);
+    assert(f.__right_ == 0);
+    assert(f.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    std::__tree_remove(root.__left_, &f);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &g);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(g.__parent_ == &root);
+    assert(g.__left_ == 0);
+    assert(g.__right_ == &h);
+    assert(g.__is_black_ == true);
+
+    assert(h.__parent_ == &g);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == false);
+
+    std::__tree_remove(root.__left_, &g);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &h);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+
+    assert(h.__parent_ == &root);
+    assert(h.__left_ == 0);
+    assert(h.__right_ == 0);
+    assert(h.__is_black_ == true);
+
+    std::__tree_remove(root.__left_, &h);
+
+    assert(std::__tree_invariant(root.__left_));
+
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == 0);
+    assert(root.__right_ == 0);
+    assert(root.__is_black_ == false);
+}
+
+int main()
+{
+    test1();
+    test2();
+    test3();
+    test4();
+}

Added: libcxx/trunk/test/std/containers/associative/tree_right_rotate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/tree_right_rotate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/tree_right_rotate.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/tree_right_rotate.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Precondition:  __x->__left_ != nullptr
+// template <class _NodePtr>
+// void
+// __tree_right_rotate(_NodePtr __x);
+
+#include <__tree>
+#include <cassert>
+
+struct Node
+{
+    Node* __left_;
+    Node* __right_;
+    Node* __parent_;
+
+    Node() : __left_(), __right_(), __parent_() {}
+};
+
+void
+test1()
+{
+    Node root;
+    Node x;
+    Node y;
+    root.__left_ = &x;
+    x.__left_ = &y;
+    x.__right_ = 0;
+    x.__parent_ = &root;
+    y.__left_ = 0;
+    y.__right_ = 0;
+    y.__parent_ = &x;
+    std::__tree_right_rotate(&x);
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &y);
+    assert(root.__right_ == 0);
+    assert(y.__parent_ == &root);
+    assert(y.__left_ == 0);
+    assert(y.__right_ == &x);
+    assert(x.__parent_ == &y);
+    assert(x.__left_ == 0);
+    assert(x.__right_ == 0);
+}
+
+void
+test2()
+{
+    Node root;
+    Node x;
+    Node y;
+    Node a;
+    Node b;
+    Node c;
+    root.__left_ = &x;
+    x.__left_ = &y;
+    x.__right_ = &c;
+    x.__parent_ = &root;
+    y.__left_ = &a;
+    y.__right_ = &b;
+    y.__parent_ = &x;
+    a.__parent_ = &y;
+    b.__parent_ = &y;
+    c.__parent_ = &x;
+    std::__tree_right_rotate(&x);
+    assert(root.__parent_ == 0);
+    assert(root.__left_ == &y);
+    assert(root.__right_ == 0);
+    assert(y.__parent_ == &root);
+    assert(y.__left_ == &a);
+    assert(y.__right_ == &x);
+    assert(x.__parent_ == &y);
+    assert(x.__left_ == &b);
+    assert(x.__right_ == &c);
+    assert(a.__parent_ == &y);
+    assert(a.__left_ == 0);
+    assert(a.__right_ == 0);
+    assert(b.__parent_ == &x);
+    assert(b.__left_ == 0);
+    assert(b.__right_ == 0);
+    assert(c.__parent_ == &x);
+    assert(c.__left_ == 0);
+    assert(c.__right_ == 0);
+}
+
+int main()
+{
+    test1();
+    test2();
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//     explicit priority_queue(const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class T>
+struct test
+    : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+    typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+    typedef typename base::container_type container_type;
+    typedef typename base::value_compare value_compare;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const value_compare& comp, const test_allocator<int>& a)
+        : base(comp, c, a) {}
+    test(const value_compare& comp, const container_type& c,
+        const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(const value_compare& comp, container_type&& c,
+         const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+
+    using base::c;
+};
+
+int main()
+{
+    test<int> q((test_allocator<int>(3)));
+    assert(q.c.get_allocator() == test_allocator<int>(3));
+    assert(q.c.size() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//     priority_queue(const Compare& comp, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class T>
+struct test
+    : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+    typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+    typedef typename base::container_type container_type;
+    typedef typename base::value_compare value_compare;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const value_compare& comp, const test_allocator<int>& a)
+        : base(comp, a) {}
+    test(const value_compare& comp, const container_type& c,
+        const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(const value_compare& comp, container_type&& c,
+         const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+
+    using base::c;
+};
+
+int main()
+{
+    test<int> q(std::less<int>(), test_allocator<int>(3));
+    assert(q.c.get_allocator() == test_allocator<int>(3));
+    assert(q.c.size() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//     priority_queue(const Compare& comp, const container_type& c,
+//                    const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+template <class T>
+struct test
+    : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+    typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+    typedef typename base::container_type container_type;
+    typedef typename base::value_compare value_compare;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const value_compare& comp, const test_allocator<int>& a)
+        : base(comp, a) {}
+    test(const value_compare& comp, const container_type& c,
+        const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(const value_compare& comp, container_type&& c,
+         const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+
+    using base::c;
+};
+
+int main()
+{
+    typedef std::vector<int, test_allocator<int> > C;
+    C v = make<C>(5);
+    test<int> q(std::less<int>(), v, test_allocator<int>(3));
+    assert(q.c.get_allocator() == test_allocator<int>(3));
+    assert(q.size() == 5);
+    assert(q.top() == 4);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//     priority_queue(const Compare& comp, container_type&& c,
+//                    const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+template <class T>
+struct test
+    : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+    typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+    typedef typename base::container_type container_type;
+    typedef typename base::value_compare value_compare;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const value_compare& comp, const test_allocator<int>& a)
+        : base(comp, a) {}
+    test(const value_compare& comp, const container_type& c,
+        const test_allocator<int>& a) : base(comp, c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(const value_compare& comp, container_type&& c,
+         const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+
+    using base::c;
+};
+
+int main()
+{
+    typedef std::vector<int, test_allocator<int> > C;
+    test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
+    assert(q.c.get_allocator() == test_allocator<int>(3));
+    assert(q.size() == 5);
+    assert(q.top() == 4);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//     priority_queue(const priority_queue& q, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+#include "test_allocator.h"
+
+template <class T>
+struct test
+    : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+    typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+    typedef typename base::container_type container_type;
+    typedef typename base::value_compare value_compare;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const value_compare& comp, const test_allocator<int>& a)
+        : base(comp, c, a) {}
+    test(const value_compare& comp, const container_type& c,
+         const test_allocator<int>& a) : base(comp, c, a) {}
+    test(const test& q, const test_allocator<int>& a) : base(q, a) {}
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+
+    using base::c;
+};
+
+int main()
+{
+    test<int> qo(std::less<int>(),
+                      make<std::vector<int, test_allocator<int> > >(5),
+                      test_allocator<int>(2));
+    test<int> q(qo, test_allocator<int>(6));
+    assert(q.size() == 5);
+    assert(q.c.get_allocator() == test_allocator<int>(6));
+    assert(q.top() == int(4));
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//     priority_queue(priority_queue&& q, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#include "test_allocator.h"
+
+template <class T>
+struct test
+    : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
+{
+    typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
+    typedef typename base::container_type container_type;
+    typedef typename base::value_compare value_compare;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const value_compare& comp, const test_allocator<int>& a)
+        : base(comp, c, a) {}
+    test(const value_compare& comp, const container_type& c,
+        const test_allocator<int>& a) : base(comp, c, a) {}
+    test(const value_compare& comp, container_type&& c,
+         const test_allocator<int>& a) : base(comp, std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+
+    using base::c;
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test<MoveOnly> qo(std::less<MoveOnly>(),
+                      make<std::vector<MoveOnly, test_allocator<MoveOnly> > >(5),
+                      test_allocator<MoveOnly>(2));
+    test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
+    assert(q.size() == 5);
+    assert(q.c.get_allocator() == test_allocator<MoveOnly>(6));
+    assert(q.top() == MoveOnly(4));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue& operator=(const priority_queue&) = default;
+
+#include <queue>
+#include <cassert>
+#include <functional>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::vector<int> v = make<std::vector<int> >(5);
+    std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
+    std::priority_queue<int, std::vector<int>, std::greater<int> > q;
+    q = qo;
+    assert(q.size() == 5);
+    assert(q.top() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue& operator=(priority_queue&& q);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+    std::priority_queue<MoveOnly> q;
+    q = std::move(qo);
+    assert(q.size() == 5);
+    assert(q.top() == MoveOnly(4));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit priority_queue(const Compare& comp);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+
+int main()
+{
+    std::priority_queue<int, std::vector<int, stack_allocator<int, 10> > > q((std::less<int>()));
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    assert(q.size() == 2);
+    assert(q.top() == 2);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit priority_queue(const Compare& comp, const container_type& c);
+
+#include <queue>
+#include <cassert>
+#include <functional>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::vector<int> v = make<std::vector<int> >(5);
+    std::priority_queue<int, std::vector<int>, std::greater<int> > q(std::greater<int>(), v);
+    assert(q.size() == 5);
+    assert(q.top() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit priority_queue(const Compare& comp, container_type&& c);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::priority_queue<MoveOnly> q(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+    assert(q.size() == 5);
+    assert(q.top() == MoveOnly(4));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue(const priority_queue&) = default;
+
+#include <queue>
+#include <cassert>
+#include <functional>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::vector<int> v = make<std::vector<int> >(5);
+    std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
+    std::priority_queue<int, std::vector<int>, std::greater<int> > q = qo;
+    assert(q.size() == 5);
+    assert(q.top() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+#include <queue>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+
+int main()
+{
+    std::priority_queue<int, std::vector<int, stack_allocator<int, 10> > > q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    assert(q.size() == 2);
+    assert(q.top() == 2);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+//   priority_queue(InputIterator first, InputIterator last);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    int a[] = {3, 5, 2, 0, 6, 8, 1};
+    int* an = a + sizeof(a)/sizeof(a[0]);
+    std::priority_queue<int> q(a, an);
+    assert(q.size() == an - a);
+    assert(q.top() == 8);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+//   priority_queue(InputIterator first, InputIterator last, const Compare& comp);
+
+#include <queue>
+#include <cassert>
+#include <functional>
+
+int main()
+{
+    int a[] = {3, 5, 2, 0, 6, 8, 1};
+    int* an = a + sizeof(a)/sizeof(a[0]);
+    std::priority_queue<int, std::vector<int>, std::greater<int> >
+        q(a, an, std::greater<int>());
+    assert(q.size() == an - a);
+    assert(q.top() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+//   priority_queue(InputIterator first, InputIterator last,
+//                  const Compare& comp, const container_type& c);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    int a[] = {3, 5, 2, 0, 6, 8, 1};
+    const int n = sizeof(a)/sizeof(a[0]);
+    std::vector<int> v(a, a+n/2);
+    std::priority_queue<int> q(a+n/2, a+n, std::less<int>(), v);
+    assert(q.size() == n);
+    assert(q.top() == 8);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class InputIterator>
+//   priority_queue(InputIterator first, InputIterator last,
+//                  const Compare& comp, container_type&& c);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    int a[] = {3, 5, 2, 0, 6, 8, 1};
+    const int n = sizeof(a)/sizeof(a[0]);
+    std::priority_queue<MoveOnly> q(a+n/2, a+n,
+                                    std::less<MoveOnly>(),
+                                    std::vector<MoveOnly>(a, a+n/2));
+    assert(q.size() == n);
+    assert(q.top() == MoveOnly(8));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue(priority_queue&& q);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
+    std::priority_queue<MoveOnly> q = std::move(qo);
+    assert(q.size() == 5);
+    assert(q.top() == MoveOnly(4));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue()
+//        noexcept(is_nothrow_default_constructible<container_type>::value &&
+//                 is_nothrow_default_constructible<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::priority_queue<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/dtor_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// ~priority_queue() // implied noexcept;
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::priority_queue<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_assign_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue& operator=(priority_queue&& c)
+//     noexcept(is_nothrow_move_assignable<container_type>::value &&
+//              is_nothrow_move_assignable<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::priority_queue<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue(priority_queue&&)
+//        noexcept(is_nothrow_move_constructible<container_type>::value &&
+//                 is_nothrow_move_constructible<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::priority_queue<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// template <class... Args> void emplace(Args&&... args);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::priority_queue<Emplaceable> q;
+    q.emplace(1, 2.5);
+    assert(q.top() == Emplaceable(1, 2.5));
+    q.emplace(3, 4.5);
+    assert(q.top() == Emplaceable(3, 4.5));
+    q.emplace(2, 3.5);
+    assert(q.top() == Emplaceable(3, 4.5));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// bool empty() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::priority_queue<int> q;
+    assert(q.empty());
+    q.push(1);
+    assert(!q.empty());
+    q.pop();
+    assert(q.empty());
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void pop();
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::priority_queue<int> q;
+    q.push(1);
+    assert(q.top() == 1);
+    q.push(3);
+    assert(q.top() == 3);
+    q.push(2);
+    assert(q.top() == 3);
+    q.pop();
+    assert(q.top() == 2);
+    q.pop();
+    assert(q.top() == 1);
+    q.pop();
+    assert(q.empty());
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void push(const value_type& v);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::priority_queue<int> q;
+    q.push(1);
+    assert(q.top() == 1);
+    q.push(3);
+    assert(q.top() == 3);
+    q.push(2);
+    assert(q.top() == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void push(value_type&& v);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::priority_queue<MoveOnly> q;
+    q.push(1);
+    assert(q.top() == 1);
+    q.push(3);
+    assert(q.top() == 3);
+    q.push(2);
+    assert(q.top() == 3);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// size_type size() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::priority_queue<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    assert(q.size() == 1);
+    q.pop();
+    assert(q.size() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// void swap(priority_queue& q);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::priority_queue<int> q1;
+    std::priority_queue<int> q2;
+    q1.push(1);
+    q1.push(3);
+    q1.push(2);
+    q1.swap(q2);
+    assert(q1.empty());
+    assert(q2.size() == 3);
+    assert(q2.top() == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// const_reference top() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::priority_queue<int> q;
+    q.push(1);
+    assert(q.top() == 1);
+    q.push(3);
+    assert(q.top() == 3);
+    q.push(2);
+    assert(q.top() == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// priority_queue();
+
+// template <class T, class Container, class Compare>
+//   void swap(priority_queue<T, Container, Compare>& x,
+//             priority_queue<T, Container, Compare>& y);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::priority_queue<int> q1;
+    std::priority_queue<int> q2;
+    q1.push(1);
+    q1.push(3);
+    q1.push(2);
+    swap(q1, q2);
+    assert(q1.empty());
+    assert(q2.size() == 3);
+    assert(q2.top() == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void swap(priority_queue& c)
+//     noexcept(__is_nothrow_swappable<container_type>::value &&
+//              __is_nothrow_swappable<Compare>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::priority_queue<MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container = vector<T>,
+//           class Compare = less<typename Container::value_type>>
+// class priority_queue
+// {
+// public:
+//     typedef Container                                container_type;
+//     typedef typename container_type::value_type      value_type;
+//     typedef typename container_type::reference       reference;
+//     typedef typename container_type::const_reference const_reference;
+//     typedef typename container_type::size_type       size_type;
+//
+// protected:
+//     container_type c;
+//     Compare comp;
+
+#include <queue>
+#include <cassert>
+#include <type_traits>
+
+struct test
+    : private std::priority_queue<int>
+{
+    test()
+    {
+        c.push_back(1);
+        assert(comp(1, 2));
+    }
+};
+
+struct C
+{
+    typedef int value_type;
+    typedef int& reference;
+    typedef const int& const_reference;
+    typedef int size_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
+    static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::container_type, std::deque<int> >::value), "");
+    static_assert((std::is_same<std::priority_queue<double, std::deque<int> >::value_type, int>::value), "");
+    static_assert((std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
+    static_assert((std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
+    static_assert((std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
+    static_assert((std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
+    static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
+    test t;
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//   explicit queue(const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+
+struct test
+    : private std::queue<int, std::deque<int, test_allocator<int> > >
+{
+    typedef std::queue<int, std::deque<int, test_allocator<int> > > base;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+};
+
+int main()
+{
+    test q(test_allocator<int>(3));
+    assert(q.get_allocator() == test_allocator<int>(3));
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//   queue(const container_type& c, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+typedef std::deque<int, test_allocator<int> > C;
+
+struct test
+    : public std::queue<int, C>
+{
+    typedef std::queue<int, C> base;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+};
+
+int main()
+{
+    C d = make<C>(5);
+    test q(d, test_allocator<int>(4));
+    assert(q.get_allocator() == test_allocator<int>(4));
+    assert(q.size() == 5);
+    for (int i = 0; i < d.size(); ++i)
+    {
+        assert(q.front() == d[i]);
+        q.pop();
+    }
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_queue_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//   queue(const queue& q, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+typedef std::deque<int, test_allocator<int> > C;
+
+template <class T>
+struct test
+    : public std::queue<T, C>
+{
+    typedef std::queue<T, C> base;
+    typedef test_allocator<int>      allocator_type;
+    typedef typename base::container_type container_type;
+
+    explicit test(const allocator_type& a) : base(a) {}
+    test(const container_type& c, const allocator_type& a) : base(c, a) {}
+    test(const test& q, const allocator_type& a) : base(q, a) {}
+    allocator_type get_allocator() {return this->c.get_allocator();}
+};
+
+int main()
+{
+    test<int> q(make<C>(5), test_allocator<int>(4));
+    test<int> q2(q, test_allocator<int>(5));
+    assert(q2.get_allocator() == test_allocator<int>(5));
+    assert(q2.size() == 5);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//   queue(const container_type& c, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
+
+template <class T>
+struct test
+    : public std::queue<T, C>
+{
+    typedef std::queue<T, C> base;
+    typedef test_allocator<MoveOnly>      allocator_type;
+    typedef typename base::container_type container_type;
+
+    explicit test(const allocator_type& a) : base(a) {}
+    test(const container_type& c, const allocator_type& a) : base(c, a) {}
+    test(container_type&& c, const allocator_type& a) : base(std::move(c), a) {}
+    test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+    allocator_type get_allocator() {return this->c.get_allocator();}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+    assert(q.get_allocator() == test_allocator<MoveOnly>(4));
+    assert(q.size() == 5);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class Alloc>
+//   queue(queue&& q, const Alloc& a);
+
+#include <queue>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
+
+template <class T>
+struct test
+    : public std::queue<T, C>
+{
+    typedef std::queue<T, C> base;
+    typedef test_allocator<MoveOnly>      allocator_type;
+    typedef typename base::container_type container_type;
+
+    explicit test(const allocator_type& a) : base(a) {}
+    test(const container_type& c, const allocator_type& a) : base(c, a) {}
+    test(container_type&& c, const allocator_type& a) : base(std::move(c), a) {}
+    test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+    allocator_type get_allocator() {return this->c.get_allocator();}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+    test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5));
+    assert(q2.get_allocator() == test_allocator<MoveOnly>(5));
+    assert(q2.size() == 5);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit queue(const container_type& c);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::deque<int> d = make<std::deque<int> >(5);
+    std::queue<int> q(d);
+    assert(q.size() == 5);
+    for (int i = 0; i < d.size(); ++i)
+    {
+        assert(q.front() == d[i]);
+        q.pop();
+    }
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue(const queue&) = default;
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::queue<int> q(make<std::deque<int> >(5));
+    std::queue<int> q2 = q;
+    assert(q2 == q);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue();
+
+#include <queue>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+
+int main()
+{
+    std::queue<int, std::vector<int, stack_allocator<int, 10> > > q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    assert(q.size() == 2);
+    assert(q.front() == 1);
+    assert(q.back() == 2);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue(queue&& q);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+    std::queue<MoveOnly> q2 = std::move(q);
+    assert(q2.size() == 5);
+    assert(q.empty());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// explicit queue(container_type&& c);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+    assert(q.size() == 5);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue()
+//        noexcept(is_nothrow_default_constructible<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::queue<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/dtor_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// ~queue() // implied noexcept;
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::queue<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_assign_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue& operator=(queue&& c)
+//     noexcept(is_nothrow_move_assignable<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::queue<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue(queue&&)
+//        noexcept(is_nothrow_move_constructible<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::queue<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue& operator=(const queue& q);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::queue<int> q(make<std::deque<int> >(5));
+    std::queue<int> q2;
+    q2 = q;
+    assert(q2 == q);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue& operator=(queue&& q);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+    std::queue<MoveOnly> q2;
+    q2 = std::move(q);
+    assert(q2.size() == 5);
+    assert(q.empty());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// reference back();
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    int& ir = q.back();
+    assert(ir == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/back_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// const_reference back() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    const std::queue<int>& cqr = q;
+    const int& cir = cqr.back();
+    assert(cir == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class... Args> void emplace(Args&&... args);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::queue<Emplaceable> q;
+    q.emplace(1, 2.5);
+    q.emplace(2, 3.5);
+    q.emplace(3, 4.5);
+    assert(q.size() == 3);
+    assert(q.front() == Emplaceable(1, 2.5));
+    assert(q.back() == Emplaceable(3, 4.5));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/empty.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// bool empty() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    assert(q.empty());
+    q.push(1);
+    assert(!q.empty());
+    q.pop();
+    assert(q.empty());
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// reference front();
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    int& ir = q.front();
+    assert(ir == 1);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/front_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// const_reference front() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    const std::queue<int>& cqr = q;
+    const int& cir = cqr.front();
+    assert(cir == 1);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/pop.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void pop();
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    assert(q.size() == 3);
+    assert(q.front() == 1);
+    assert(q.back() == 3);
+    q.pop();
+    assert(q.size() == 2);
+    assert(q.front() == 2);
+    assert(q.back() == 3);
+    q.pop();
+    assert(q.size() == 1);
+    assert(q.front() == 3);
+    assert(q.back() == 3);
+    q.pop();
+    assert(q.size() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void push(const value_type& v);
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    q.push(1);
+    assert(q.size() == 1);
+    assert(q.front() == 1);
+    assert(q.back() == 1);
+    q.push(2);
+    assert(q.size() == 2);
+    assert(q.front() == 1);
+    assert(q.back() == 2);
+    q.push(3);
+    assert(q.size() == 3);
+    assert(q.front() == 1);
+    assert(q.back() == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void push(value_type&& v);
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::queue<MoveOnly> q;
+    q.push(MoveOnly(1));
+    assert(q.size() == 1);
+    assert(q.front() == MoveOnly(1));
+    assert(q.back() == MoveOnly(1));
+    q.push(MoveOnly(2));
+    assert(q.size() == 2);
+    assert(q.front() == MoveOnly(1));
+    assert(q.back() == MoveOnly(2));
+    q.push(MoveOnly(3));
+    assert(q.size() == 3);
+    assert(q.front() == MoveOnly(1));
+    assert(q.back() == MoveOnly(3));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// size_type size() const;
+
+#include <queue>
+#include <cassert>
+
+int main()
+{
+    std::queue<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    assert(q.size() == 1);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void swap(queue& q);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::queue<int> q1 = make<std::queue<int> >(5);
+    std::queue<int> q2 = make<std::queue<int> >(10);
+    std::queue<int> q1_save = q1;
+    std::queue<int> q2_save = q2;
+    q1.swap(q2);
+    assert(q1 == q2_save);
+    assert(q2 == q1_save);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container = deque<T>>
+// class queue
+// {
+// public:
+//     typedef Container                                container_type;
+//     typedef typename container_type::value_type      value_type;
+//     typedef typename container_type::reference       reference;
+//     typedef typename container_type::const_reference const_reference;
+//     typedef typename container_type::size_type       size_type;
+//
+// protected:
+//     container_type c;
+// ...
+// };
+
+#include <queue>
+#include <type_traits>
+
+struct test
+    : private std::queue<int>
+{
+    test()
+    {
+        c.push_back(1);
+    }
+};
+
+struct C
+{
+    typedef int value_type;
+    typedef int& reference;
+    typedef const int& const_reference;
+    typedef int size_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::queue<int>::container_type, std::deque<int> >::value), "");
+    static_assert((std::is_same<std::queue<double, std::vector<int> >::container_type, std::vector<int> >::value), "");
+    static_assert((std::is_same<std::queue<double, std::vector<int> >::value_type, int>::value), "");
+    static_assert((std::is_same<std::queue<int>::reference, std::deque<int>::reference>::value), "");
+    static_assert((std::is_same<std::queue<int>::const_reference, std::deque<int>::const_reference>::value), "");
+    static_assert((std::is_same<std::queue<int>::size_type, std::deque<int>::size_type>::value), "");
+    static_assert((std::uses_allocator<std::queue<int>, std::allocator<int> >::value), "");
+    static_assert((!std::uses_allocator<std::queue<int, C>, std::allocator<int> >::value), "");
+    test t;
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/eq.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container>
+//   bool operator==(const queue<T, Container>& x,const queue<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator!=(const queue<T, Container>& x,const queue<T, Container>& y);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::queue<int> q1 = make<std::queue<int> >(5);
+    std::queue<int> q2 = make<std::queue<int> >(10);
+    std::queue<int> q1_save = q1;
+    std::queue<int> q2_save = q2;
+    assert(q1 == q1_save);
+    assert(q1 != q2);
+    assert(q2 == q2_save);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.ops/lt.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container>
+//   bool operator< (const queue<T, Container>& x,const queue<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator> (const queue<T, Container>& x,const queue<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator>=(const queue<T, Container>& x,const queue<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::queue<int> q1 = make<std::queue<int> >(5);
+    std::queue<int> q2 = make<std::queue<int> >(10);
+    assert(q1 < q2);
+    assert(q2 > q1);
+    assert(q1 <= q2);
+    assert(q2 >= q1);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container>
+//   void swap(queue<T, Container>& x, queue<T, Container>& y);
+
+#include <queue>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::queue<int> q1 = make<std::queue<int> >(5);
+    std::queue<int> q2 = make<std::queue<int> >(10);
+    std::queue<int> q1_save = q1;
+    std::queue<int> q2_save = q2;
+    swap(q1, q2);
+    assert(q1 == q2_save);
+    assert(q2 == q1_save);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// void swap(queue& c)
+//     noexcept(__is_nothrow_swappable<container_type>::value);
+
+// This tests a conforming extension
+
+#include <queue>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::queue<MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/queue/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/queue/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/queue/version.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/queue/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+#include <queue>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class Alloc>
+//   explicit stack(const Alloc& a);
+
+#include <stack>
+#include <cassert>
+
+#include "test_allocator.h"
+
+struct test
+    : private std::stack<int, std::deque<int, test_allocator<int> > >
+{
+    typedef std::stack<int, std::deque<int, test_allocator<int> > > base;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+};
+
+int main()
+{
+    test q(test_allocator<int>(3));
+    assert(q.get_allocator() == test_allocator<int>(3));
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class Alloc>
+//   stack(const container_type& c, const Alloc& a);
+
+#include <stack>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+typedef std::deque<int, test_allocator<int> > C;
+
+struct test
+    : public std::stack<int, C>
+{
+    typedef std::stack<int, C> base;
+
+    explicit test(const test_allocator<int>& a) : base(a) {}
+    test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
+    test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_allocator<int> get_allocator() {return c.get_allocator();}
+};
+
+int main()
+{
+    C d = make<C>(5);
+    test q(d, test_allocator<int>(4));
+    assert(q.get_allocator() == test_allocator<int>(4));
+    assert(q.size() == 5);
+    for (int i = 0; i < d.size(); ++i)
+    {
+        assert(q.top() == d[d.size() - i - 1]);
+        q.pop();
+    }
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_copy_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class Alloc>
+//   stack(const stack& q, const Alloc& a);
+
+#include <stack>
+#include <cassert>
+
+#include "test_allocator.h"
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(int(i));
+    return c;
+}
+
+typedef std::deque<int, test_allocator<int> > C;
+
+template <class T>
+struct test
+    : public std::stack<T, C>
+{
+    typedef std::stack<T, C> base;
+    typedef test_allocator<int>      allocator_type;
+    typedef typename base::container_type container_type;
+
+    explicit test(const allocator_type& a) : base(a) {}
+    test(const container_type& c, const allocator_type& a) : base(c, a) {}
+    test(const test& q, const allocator_type& a) : base(q, a) {}
+    allocator_type get_allocator() {return this->c.get_allocator();}
+};
+
+int main()
+{
+    test<int> q(make<C>(5), test_allocator<int>(4));
+    test<int> q2(q, test_allocator<int>(5));
+    assert(q2.get_allocator() == test_allocator<int>(5));
+    assert(q2.size() == 5);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class Alloc>
+//   stack(const container_type& c, const Alloc& a);
+
+#include <stack>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
+
+template <class T>
+struct test
+    : public std::stack<T, C>
+{
+    typedef std::stack<T, C> base;
+    typedef test_allocator<MoveOnly>      allocator_type;
+    typedef typename base::container_type container_type;
+
+    explicit test(const allocator_type& a) : base(a) {}
+    test(const container_type& c, const allocator_type& a) : base(c, a) {}
+    test(container_type&& c, const allocator_type& a) : base(std::move(c), a) {}
+    test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+    allocator_type get_allocator() {return this->c.get_allocator();}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+    assert(q.get_allocator() == test_allocator<MoveOnly>(4));
+    assert(q.size() == 5);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class Alloc>
+//   stack(stack&& q, const Alloc& a);
+
+#include <stack>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+typedef std::deque<MoveOnly, test_allocator<MoveOnly> > C;
+
+template <class T>
+struct test
+    : public std::stack<T, C>
+{
+    typedef std::stack<T, C> base;
+    typedef test_allocator<MoveOnly>      allocator_type;
+    typedef typename base::container_type container_type;
+
+    explicit test(const allocator_type& a) : base(a) {}
+    test(const container_type& c, const allocator_type& a) : base(c, a) {}
+    test(container_type&& c, const allocator_type& a) : base(std::move(c), a) {}
+    test(test&& q, const allocator_type& a) : base(std::move(q), a) {}
+    allocator_type get_allocator() {return this->c.get_allocator();}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test<MoveOnly> q(make<C>(5), test_allocator<MoveOnly>(4));
+    test<MoveOnly> q2(std::move(q), test_allocator<MoveOnly>(5));
+    assert(q2.get_allocator() == test_allocator<MoveOnly>(5));
+    assert(q2.size() == 5);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// explicit stack(const container_type& c);
+
+#include <stack>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::deque<int> d = make<std::deque<int> >(5);
+    std::stack<int> q(d);
+    assert(q.size() == 5);
+    for (int i = 0; i < d.size(); ++i)
+    {
+        assert(q.top() == d[d.size() - i - 1]);
+        q.pop();
+    }
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack(const stack&) = default;
+
+#include <stack>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::stack<int> q(make<std::deque<int> >(5));
+    std::stack<int> q2 = q;
+    assert(q2 == q);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack();
+
+#include <stack>
+#include <vector>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+
+int main()
+{
+    std::stack<int, std::vector<int, stack_allocator<int, 10> > > q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    assert(q.size() == 2);
+    assert(q.top() == 2);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack(stack&& q);
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+    std::stack<MoveOnly> q2 = std::move(q);
+    assert(q2.size() == 5);
+    assert(q.empty());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// explicit stack(container_type&& c);
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+    assert(q.size() == 5);
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack()
+//        noexcept(is_nothrow_default_constructible<container_type>::value);
+
+// This tests a conforming extension
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::stack<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/dtor_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// ~stack() // implied noexcept;
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::stack<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_assign_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack& operator=(stack&& c)
+//     noexcept(is_nothrow_move_assignable<container_type>::value);
+
+// This tests a conforming extension
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::stack<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack(stack&&)
+//        noexcept(is_nothrow_move_constructible<container_type>::value);
+
+// This tests a conforming extension
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::stack<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack& operator=(const stack& q);
+
+#include <stack>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(i);
+    return c;
+}
+
+int main()
+{
+    std::stack<int> q(make<std::deque<int> >(5));
+    std::stack<int> q2;
+    q2 = q;
+    assert(q2 == q);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// stack& operator=(stack&& q);
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push_back(MoveOnly(i));
+    return c;
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+    std::stack<MoveOnly> q2;
+    q2 = std::move(q);
+    assert(q2.size() == 5);
+    assert(q.empty());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class... Args> void emplace(Args&&... args);
+
+#include <stack>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::stack<Emplaceable> q;
+    q.emplace(1, 2.5);
+    q.emplace(2, 3.5);
+    q.emplace(3, 4.5);
+    assert(q.size() == 3);
+    assert(q.top() == Emplaceable(3, 4.5));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/empty.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// bool empty() const;
+
+#include <stack>
+#include <cassert>
+
+int main()
+{
+    std::stack<int> q;
+    assert(q.empty());
+    q.push(1);
+    assert(!q.empty());
+    q.pop();
+    assert(q.empty());
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/pop.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// void pop();
+
+#include <stack>
+#include <cassert>
+
+int main()
+{
+    std::stack<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    assert(q.size() == 3);
+    assert(q.top() == 3);
+    q.pop();
+    assert(q.size() == 2);
+    assert(q.top() == 2);
+    q.pop();
+    assert(q.size() == 1);
+    assert(q.top() == 1);
+    q.pop();
+    assert(q.size() == 0);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// void push(const value_type& v);
+
+#include <stack>
+#include <cassert>
+
+int main()
+{
+    std::stack<int> q;
+    q.push(1);
+    assert(q.size() == 1);
+    assert(q.top() == 1);
+    q.push(2);
+    assert(q.size() == 2);
+    assert(q.top() == 2);
+    q.push(3);
+    assert(q.size() == 3);
+    assert(q.top() == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// void push(value_type&& v);
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::stack<MoveOnly> q;
+    q.push(MoveOnly(1));
+    assert(q.size() == 1);
+    assert(q.top() == MoveOnly(1));
+    q.push(MoveOnly(2));
+    assert(q.size() == 2);
+    assert(q.top() == MoveOnly(2));
+    q.push(MoveOnly(3));
+    assert(q.size() == 3);
+    assert(q.top() == MoveOnly(3));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// size_type size() const;
+
+#include <stack>
+#include <cassert>
+
+int main()
+{
+    std::stack<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    assert(q.size() == 1);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// void swap(stack& q);
+
+#include <stack>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::stack<int> q1 = make<std::stack<int> >(5);
+    std::stack<int> q2 = make<std::stack<int> >(10);
+    std::stack<int> q1_save = q1;
+    std::stack<int> q2_save = q2;
+    q1.swap(q2);
+    assert(q1 == q2_save);
+    assert(q2 == q1_save);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// reference top();
+
+#include <stack>
+#include <cassert>
+
+int main()
+{
+    std::stack<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    int& ir = q.top();
+    assert(ir == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/top_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// const_reference top() const;
+
+#include <stack>
+#include <cassert>
+
+int main()
+{
+    std::stack<int> q;
+    assert(q.size() == 0);
+    q.push(1);
+    q.push(2);
+    q.push(3);
+    const std::stack<int>& cqr = q;
+    const int& cir = cqr.top();
+    assert(cir == 3);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class T, class Container = deque<T>>
+// class stack
+// {
+// public:
+//     typedef Container                                container_type;
+//     typedef typename container_type::value_type      value_type;
+//     typedef typename container_type::reference       reference;
+//     typedef typename container_type::const_reference const_reference;
+//     typedef typename container_type::size_type       size_type;
+//
+// protected:
+//     container_type c;
+// ...
+// };
+
+#include <stack>
+#include <vector>
+#include <type_traits>
+
+struct test
+    : private std::stack<int>
+{
+    test()
+    {
+        c.push_back(1);
+    }
+};
+
+struct C
+{
+    typedef int value_type;
+    typedef int& reference;
+    typedef const int& const_reference;
+    typedef int size_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::stack<int>::container_type, std::deque<int> >::value), "");
+    static_assert((std::is_same<std::stack<double, std::vector<int> >::container_type, std::vector<int> >::value), "");
+    static_assert((std::is_same<std::stack<double, std::vector<int> >::value_type, int>::value), "");
+    static_assert((std::is_same<std::stack<int>::reference, std::deque<int>::reference>::value), "");
+    static_assert((std::is_same<std::stack<int>::const_reference, std::deque<int>::const_reference>::value), "");
+    static_assert((std::is_same<std::stack<int>::size_type, std::deque<int>::size_type>::value), "");
+    static_assert((std::uses_allocator<std::stack<int>, std::allocator<int> >::value), "");
+    static_assert((!std::uses_allocator<std::stack<int, C>, std::allocator<int> >::value), "");
+    test t;
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/eq.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class T, class Container>
+//   bool operator==(const stack<T, Container>& x,const stack<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator!=(const stack<T, Container>& x,const stack<T, Container>& y);
+
+#include <stack>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::stack<int> q1 = make<std::stack<int> >(5);
+    std::stack<int> q2 = make<std::stack<int> >(10);
+    std::stack<int> q1_save = q1;
+    std::stack<int> q2_save = q2;
+    assert(q1 == q1_save);
+    assert(q1 != q2);
+    assert(q2 == q2_save);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.ops/lt.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class T, class Container>
+//   bool operator< (const stack<T, Container>& x,const stack<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator> (const stack<T, Container>& x,const stack<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator>=(const stack<T, Container>& x,const stack<T, Container>& y);
+//
+// template <class T, class Container>
+//   bool operator<=(const stack<T, Container>& x,const stack<T, Container>& y);
+
+#include <stack>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::stack<int> q1 = make<std::stack<int> >(5);
+    std::stack<int> q2 = make<std::stack<int> >(10);
+    assert(q1 < q2);
+    assert(q2 > q1);
+    assert(q1 <= q2);
+    assert(q2 >= q1);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// template <class T, class Container>
+//   void swap(stack<T, Container>& x, stack<T, Container>& y);
+
+#include <stack>
+#include <cassert>
+
+template <class C>
+C
+make(int n)
+{
+    C c;
+    for (int i = 0; i < n; ++i)
+        c.push(i);
+    return c;
+}
+
+int main()
+{
+    std::stack<int> q1 = make<std::stack<int> >(5);
+    std::stack<int> q2 = make<std::stack<int> >(10);
+    std::stack<int> q1_save = q1;
+    std::stack<int> q2_save = q2;
+    swap(q1, q2);
+    assert(q1 == q2_save);
+    assert(q2 == q1_save);
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+// void swap(stack& c)
+//     noexcept(__is_nothrow_swappable<container_type>::value);
+
+// This tests a conforming extension
+
+#include <stack>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::stack<MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/container.adaptors/stack/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.adaptors/stack/version.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.adaptors/stack/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <stack>
+
+#include <stack>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/associative.reqmts.except/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/associative.reqmts/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/container.requirements.dataraces/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/container.requirements.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/container.requirements.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/container.requirements.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/container.requirements.general/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/sequence.reqmts/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/unord.req/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/unord.req/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/unord.req/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/unord.req/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/container.requirements/unord.req/unord.req.except/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/containers.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/containers.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/containers.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/containers.general/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// array();
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c;
+        assert(c.size() == 3);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        C c;
+        assert(c.size() == 0);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// Construct with initizializer list
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        assert(c.size() == 3);
+        assert(c[0] == 1);
+        assert(c[1] == 2);
+        assert(c[2] == 3.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        C c = {};
+        assert(c.size() == 0);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// T *data();
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        T* p = c.data();
+        assert(p[0] == 1);
+        assert(p[1] == 2);
+        assert(p[2] == 3.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        C c = {};
+        T* p = c.data();
+        (void)p; // to placate scan-build
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// const T* data() const;
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        const T* p = c.data();
+        assert(p[0] == 1);
+        assert(p[1] == 2);
+        assert(p[2] == 3.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        const C c = {};
+        const T* p = c.data();
+        (void)p; // to placate scan-build
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// void fill(const T& u);
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        c.fill(5.5);
+        assert(c.size() == 3);
+        assert(c[0] == 5.5);
+        assert(c[1] == 5.5);
+        assert(c[2] == 5.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        C c = {};
+        c.fill(5.5);
+        assert(c.size() == 0);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.size/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <class T, size_t N> constexpr size_type array<T,N>::size();
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        assert(c.size() == 3);
+        assert(c.max_size() == 3);
+        assert(!c.empty());
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        C c = {};
+        assert(c.size() == 0);
+        assert(c.max_size() == 0);
+        assert(c.empty());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+        static_assert(c.size() == 3, "");
+        static_assert(c.max_size() == 3, "");
+        static_assert(!c.empty(), "");
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        constexpr C c = {};
+        static_assert(c.size() == 0, "");
+        static_assert(c.max_size() == 0, "");
+        static_assert(c.empty(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.special/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.special/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.special/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <class T, size_t N> void swap(array<T,N>& x, array<T,N>& y);
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c1 = {1, 2, 3.5};
+        C c2 = {4, 5, 6.5};
+        swap(c1, c2);
+        assert(c1.size() == 3);
+        assert(c1[0] == 4);
+        assert(c1[1] == 5);
+        assert(c1[2] == 6.5);
+        assert(c2.size() == 3);
+        assert(c2[0] == 1);
+        assert(c2[1] == 2);
+        assert(c2[2] == 3.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        C c1 = {};
+        C c2 = {};
+        swap(c1, c2);
+        assert(c1.size() == 0);
+        assert(c2.size() == 0);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// void swap(array& a);
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c1 = {1, 2, 3.5};
+        C c2 = {4, 5, 6.5};
+        c1.swap(c2);
+        assert(c1.size() == 3);
+        assert(c1[0] == 4);
+        assert(c1[1] == 5);
+        assert(c1[2] == 6.5);
+        assert(c2.size() == 3);
+        assert(c2[0] == 1);
+        assert(c2[1] == 2);
+        assert(c2[2] == 3.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        C c1 = {};
+        C c2 = {};
+        c1.swap(c2);
+        assert(c1.size() == 0);
+        assert(c2.size() == 0);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.fail.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <size_t I, class T, size_t N> T& get(array<T, N>& a);
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        std::get<3>(c) = 5.5;    // Can't get element 3!
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.tuple/get.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <size_t I, class T, size_t N> T& get(array<T, N>& a);
+
+#include <array>
+#include <cassert>
+
+#if __cplusplus > 201103L
+struct S {
+   std::array<int, 3> a;
+   int k;
+   constexpr S() : a{1,2,3}, k(std::get<2>(a)) {}
+   };
+
+constexpr std::array<int, 2> getArr () { return { 3, 4 }; }
+#endif
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        std::get<1>(c) = 5.5;
+        assert(c[0] == 1);
+        assert(c[1] == 5.5);
+        assert(c[2] == 3.5);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+        static_assert(std::get<0>(c) == 1, "");
+        static_assert(std::get<1>(c) == 2, "");
+        static_assert(std::get<2>(c) == 3.5, "");
+    }
+    {
+        static_assert(S().k == 3, "");
+        static_assert(std::get<1>(getArr()) == 4, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <size_t I, class T, size_t N> const T& get(const array<T, N>& a);
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        assert(std::get<0>(c) == 1);
+        assert(std::get<1>(c) == 2);
+        assert(std::get<2>(c) == 3.5);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr const C c = {1, 2, 3.5};
+        static_assert(std::get<0>(c) == 1, "");
+        static_assert(std::get<1>(c) == 2, "");
+        static_assert(std::get<2>(c) == 3.5, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <size_t I, class T, size_t N> T&& get(array<T, N>&& a);
+
+#include <array>
+#include <memory>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::unique_ptr<double> T;
+        typedef std::array<T, 1> C;
+        C c = {std::unique_ptr<double>(new double(3.5))};
+        T t = std::get<0>(std::move(c));
+        assert(*t == 3.5);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// tuple_element<I, array<T, N> >::type
+
+#include <array>
+#include <type_traits>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        static_assert((std::is_same<std::tuple_element<0, C>::type, T>::value), "");
+        static_assert((std::is_same<std::tuple_element<1, C>::type, T>::value), "");
+        static_assert((std::is_same<std::tuple_element<2, C>::type, T>::value), "");
+    }
+    {
+        typedef int T;
+        typedef std::array<T, 3> C;
+        static_assert((std::is_same<std::tuple_element<0, C>::type, T>::value), "");
+        static_assert((std::is_same<std::tuple_element<1, C>::type, T>::value), "");
+        static_assert((std::is_same<std::tuple_element<2, C>::type, T>::value), "");
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// tuple_size<array<T, N> >::value
+
+#include <array>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        static_assert((std::tuple_size<C>::value == 3), "");
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 0> C;
+        static_assert((std::tuple_size<C>::value == 0), "");
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/array.zero/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// support for zero-sized array
+
+#include <array>
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// reference operator[] (size_type)
+// const_reference operator[] (size_type); // constexpr in C++14
+// reference at (size_type)
+// const_reference at (size_type); // constexpr in C++14
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        C::reference r1 = c.at(0);
+        assert(r1 == 1);
+        r1 = 5.5;
+        assert(c.front() == 5.5);
+        
+        C::reference r2 = c.at(2);
+        assert(r2 == 3.5);
+        r2 = 7.5;
+        assert(c.back() == 7.5);
+
+        try { (void) c.at(3); }
+        catch (const std::out_of_range &) {}
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        C::const_reference r1 = c.at(0);
+        assert(r1 == 1);
+        
+        C::const_reference r2 = c.at(2);
+        assert(r2 == 3.5);
+
+        try { (void) c.at(3); }
+        catch (const std::out_of_range &) {}
+    }
+    
+#if _LIBCPP_STD_VER > 11 
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+
+        constexpr T t1 = c.at(0);
+        static_assert (t1 == 1, "");
+
+        constexpr T t2 = c.at(2);
+        static_assert (t2 == 3.5, "");
+    }
+#endif
+
+}

Added: libcxx/trunk/test/std/containers/sequences/array/begin.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/begin.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/begin.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/begin.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// iterator begin();
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        C::iterator i;
+        i = c.begin();
+        assert(*i == 1);
+        assert(&*i == c.data());
+        *i = 5.5;
+        assert(c[0] == 5.5);
+    }
+    {
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// reference front();
+// reference back();
+// const_reference front(); // constexpr in C++14
+// const_reference back(); // constexpr in C++14
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+
+        C::reference r1 = c.front();
+        assert(r1 == 1);
+        r1 = 5.5;
+        assert(c[0] == 5.5);
+        
+        C::reference r2 = c.back();
+        assert(r2 == 3.5);
+        r2 = 7.5;
+        assert(c[2] == 7.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        C::const_reference r1 = c.front();
+        assert(r1 == 1);
+
+        C::const_reference r2 = c.back();
+        assert(r2 == 3.5);
+    }
+
+#if _LIBCPP_STD_VER > 11 
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+        
+        constexpr T t1 = c.front();
+        static_assert (t1 == 1, "");
+
+        constexpr T t2 = c.back();
+        static_assert (t2 == 3.5, "");
+    }
+#endif
+
+}

Added: libcxx/trunk/test/std/containers/sequences/array/indexing.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/indexing.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/indexing.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/indexing.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// reference operator[] (size_type)
+// const_reference operator[] (size_type); // constexpr in C++14
+// reference at (size_type)
+// const_reference at (size_type); // constexpr in C++14
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        C::reference r1 = c[0];
+        assert(r1 == 1);
+        r1 = 5.5;
+        assert(c.front() == 5.5);
+        
+        C::reference r2 = c[2];
+        assert(r2 == 3.5);
+        r2 = 7.5;
+        assert(c.back() == 7.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        C::const_reference r1 = c[0];
+        assert(r1 == 1);
+        C::const_reference r2 = c[2];
+        assert(r2 == 3.5);
+    }
+    
+#if _LIBCPP_STD_VER > 11 
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+        
+        constexpr T t1 = c[0];
+        static_assert (t1 == 1, "");
+
+        constexpr T t2 = c[2];
+        static_assert (t2 == 3.5, "");
+    }
+#endif
+
+}

Added: libcxx/trunk/test/std/containers/sequences/array/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/iterators.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/iterators.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/iterators.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,110 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// iterator, const_iterator
+
+#include <array>
+#include <iterator>
+#include <cassert>
+
+int main()
+{
+    {
+    typedef std::array<int, 5> C;
+    C c;
+    C::iterator i;
+    i = c.begin();
+    C::const_iterator j;
+    j = c.cbegin();
+    assert(i == j);
+    }
+    {
+    typedef std::array<int, 0> C;
+    C c;
+    C::iterator i;
+    i = c.begin();
+    C::const_iterator j;
+    j = c.cbegin();
+    assert(i == j);
+    }
+
+#if _LIBCPP_STD_VER > 11
+    { // N3644 testing
+        {
+        typedef std::array<int, 5> C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+        assert ( ii1 == cii );
+
+        assert ( !(ii1 != ii2 ));
+        assert ( !(ii1 != cii ));
+
+        C c;
+        assert ( c.begin()   == std::begin(c));
+        assert ( c.cbegin()  == std::cbegin(c));
+        assert ( c.rbegin()  == std::rbegin(c));
+        assert ( c.crbegin() == std::crbegin(c));
+        assert ( c.end()     == std::end(c));
+        assert ( c.cend()    == std::cend(c));
+        assert ( c.rend()    == std::rend(c));
+        assert ( c.crend()   == std::crend(c));
+        
+        assert ( std::begin(c)   != std::end(c));
+        assert ( std::rbegin(c)  != std::rend(c));
+        assert ( std::cbegin(c)  != std::cend(c));
+        assert ( std::crbegin(c) != std::crend(c));
+        }
+        {
+        typedef std::array<int, 0> C;
+        C::iterator ii1{}, ii2{};
+        C::iterator ii4 = ii1;
+        C::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+
+        assert (!(ii1 != ii2 ));
+
+        assert ( (ii1 == cii ));
+        assert ( (cii == ii1 ));
+        assert (!(ii1 != cii ));
+        assert (!(cii != ii1 ));
+        assert (!(ii1 <  cii ));
+        assert (!(cii <  ii1 ));
+        assert ( (ii1 <= cii ));
+        assert ( (cii <= ii1 ));
+        assert (!(ii1 >  cii ));
+        assert (!(cii >  ii1 ));
+        assert ( (ii1 >= cii ));
+        assert ( (cii >= ii1 ));
+        assert (cii - ii1 == 0);
+        assert (ii1 - cii == 0);
+
+        C c;
+        assert ( c.begin()   == std::begin(c));
+        assert ( c.cbegin()  == std::cbegin(c));
+        assert ( c.rbegin()  == std::rbegin(c));
+        assert ( c.crbegin() == std::crbegin(c));
+        assert ( c.end()     == std::end(c));
+        assert ( c.cend()    == std::cend(c));
+        assert ( c.rend()    == std::rend(c));
+        assert ( c.crend()   == std::crend(c));
+
+        assert ( std::begin(c)   == std::end(c));
+        assert ( std::rbegin(c)  == std::rend(c));
+        assert ( std::cbegin(c)  == std::cend(c));
+        assert ( std::crbegin(c) == std::crend(c));
+        }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <class T, size_t N >
+// struct array
+// {
+//     // types:
+//     typedef T& reference;
+//     typedef const T& const_reference;
+//     typedef implementation defined iterator;
+//     typedef implementation defined const_iterator;
+//     typedef T value_type;
+//     typedef T* pointer;
+//     typedef size_t size_type;
+//     typedef ptrdiff_t difference_type;
+//     typedef T value_type;
+//     typedef std::reverse_iterator<iterator> reverse_iterator;
+//     typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+#include <array>
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 10> C;
+        static_assert((std::is_same<C::reference, T&>::value), "");
+        static_assert((std::is_same<C::const_reference, const T&>::value), "");
+        static_assert((std::is_same<C::iterator, T*>::value), "");
+        static_assert((std::is_same<C::const_iterator, const T*>::value), "");
+        static_assert((std::is_same<C::pointer, T*>::value), "");
+        static_assert((std::is_same<C::const_pointer, const T*>::value), "");
+        static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+        static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+        static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
+        static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+    }
+    {
+        typedef int* T;
+        typedef std::array<T, 0> C;
+        static_assert((std::is_same<C::reference, T&>::value), "");
+        static_assert((std::is_same<C::const_reference, const T&>::value), "");
+        static_assert((std::is_same<C::iterator, T*>::value), "");
+        static_assert((std::is_same<C::const_iterator, const T*>::value), "");
+        static_assert((std::is_same<C::pointer, T*>::value), "");
+        static_assert((std::is_same<C::const_pointer, const T*>::value), "");
+        static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+        static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+        static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
+        static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/array/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/version.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/array/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+#include <array>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+//       reference operator[](size_type __i);
+// const_reference operator[](size_type __i) const;
+//
+//       reference at(size_type __i);
+// const_reference at(size_type __i) const;
+//
+//       reference front();
+// const_reference front() const;
+//
+//       reference back();
+// const_reference back() const;
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+int main()
+{
+    {
+        std::deque<int> c = make<std::deque<int> >(10);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c[i] == i);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c.at(i) == i);
+        assert(c.front() == 0);
+        assert(c.back() == 9);
+    }
+    {
+        const std::deque<int> c = make<std::deque<int> >(10);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c[i] == i);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c.at(i) == i);
+        assert(c.front() == 0);
+        assert(c.back() == 9);
+    }
+#if __cplusplus >= 201103L
+    {
+        std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c[i] == i);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c.at(i) == i);
+        assert(c.front() == 0);
+        assert(c.back() == 9);
+    }
+    {
+        const std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c[i] == i);
+        for (unsigned i = 0; i < 10; ++i)
+            assert(c.at(i) == i);
+        assert(c.front() == 0);
+        assert(c.back() == 9);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void resize(size_type n);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1, int size)
+{
+    typedef typename C::const_iterator CI;
+    typename C::size_type c1_osize = c1.size();
+    c1.resize(size);
+    assert(c1.size() == size);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    CI i = c1.begin();
+    for (int j = 0; j < std::min(c1_osize, c1.size()); ++j, ++i)
+        assert(*i == j);
+    for (int j = c1_osize; j < c1.size(); ++j, ++i)
+        assert(*i == 0);
+}
+
+template <class C>
+void
+testN(int start, int N, int M)
+{
+    typedef typename C::const_iterator CI;
+    C c1 = make<C>(N, start);
+    test(c1, M);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void resize(size_type n, const value_type& v);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1, int size, int x)
+{
+    typedef typename C::const_iterator CI;
+    typename C::size_type c1_osize = c1.size();
+    c1.resize(size, x);
+    assert(c1.size() == size);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    CI i = c1.begin();
+    for (int j = 0; j < std::min(c1_osize, c1.size()); ++j, ++i)
+        assert(*i == j);
+    for (int j = c1_osize; j < c1.size(); ++j, ++i)
+        assert(*i == x);
+}
+
+template <class C>
+void
+testN(int start, int N, int M)
+{
+    typedef typename C::const_iterator CI;
+    C c1 = make<C>(N, start);
+    test(c1, M, -10);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int, min_allocator<int>>>(rng[i], rng[j], rng[k]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void shrink_to_fit();
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1)
+{
+    C s = c1;
+    c1.shrink_to_fit();
+    assert(c1 == s);
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    typedef typename C::const_iterator CI;
+    C c1 = make<C>(N, start);
+    test(c1);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// explicit deque(const allocator_type& a);
+
+#include <deque>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "../../../NotConstructible.h"
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void
+test(const Allocator& a)
+{
+    std::deque<T, Allocator> d(a);
+    assert(d.size() == 0);
+    assert(d.get_allocator() == a);
+}
+
+int main()
+{
+    test<int>(std::allocator<int>());
+    test<NotConstructible>(test_allocator<NotConstructible>(3));
+#if __cplusplus >= 201103L
+    test<int>(min_allocator<int>());
+    test<NotConstructible>(min_allocator<NotConstructible>{});
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void assign(initializer_list<value_type> il);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::deque<int> d;
+    d.assign({3, 4, 5, 6});
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::deque<int, min_allocator<int>> d;
+    d.assign({3, 4, 5, 6});
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// template <class InputIterator>
+//   void assign(InputIterator f, InputIterator l);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1, const C& c2)
+{
+    std::size_t c1_osize = c1.size();
+    c1.assign(c2.begin(), c2.end());
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    assert(c1 == c2);
+}
+
+template <class C>
+void
+testN(int start, int N, int M)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    C c1 = make<C>(N, start);
+    C c2 = make<C>(M);
+    test(c1, c2);
+}
+
+template <class C>
+void
+testI(C& c1, const C& c2)
+{
+    typedef typename C::const_iterator CI;
+    typedef input_iterator<CI> ICI;
+    std::size_t c1_osize = c1.size();
+    c1.assign(ICI(c2.begin()), ICI(c2.end()));
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    assert(c1 == c2);
+}
+
+template <class C>
+void
+testNI(int start, int N, int M)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    C c1 = make<C>(N, start);
+    C c2 = make<C>(M);
+    testI(c1, c2);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+    testNI<std::deque<int> >(1500, 2000, 1000);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+    testNI<std::deque<int, min_allocator<int>> >(1500, 2000, 1000);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void assign(size_type n, const value_type& v);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1, int size, int v)
+{
+    typedef typename C::const_iterator CI;
+    std::size_t c1_osize = c1.size();
+    c1.assign(size, v);
+    assert(c1.size() == size);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    for (CI i = c1.begin(); i != c1.end(); ++i)
+        assert(*i == v);
+}
+
+template <class C>
+void
+testN(int start, int N, int M)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    C c1 = make<C>(N, start);
+    test(c1, M, -10);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(const deque&);
+
+#include <deque>
+#include <cassert>
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class C>
+void
+test(const C& x)
+{
+    C c(x);
+    assert(c == x);
+}
+
+int main()
+{
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        test(std::deque<int>(ab, an));
+    }
+    {
+        std::deque<int, test_allocator<int> > v(3, 2, test_allocator<int>(5));
+        std::deque<int, test_allocator<int> > v2 = v;
+        assert(v2 == v);
+        assert(v2.get_allocator() == v.get_allocator());
+    }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
+        std::deque<int, other_allocator<int> > v2 = v;
+        assert(v2 == v);
+        assert(v2.get_allocator() == other_allocator<int>(-2));
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        test(std::deque<int, min_allocator<int>>(ab, an));
+    }
+    {
+        std::deque<int, min_allocator<int> > v(3, 2, min_allocator<int>());
+        std::deque<int, min_allocator<int> > v2 = v;
+        assert(v2 == v);
+        assert(v2.get_allocator() == v.get_allocator());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(const deque& c, const allocator_type& a);
+
+#include <deque>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class C>
+void
+test(const C& x, const typename C::allocator_type& a)
+{
+    C c(x, a);
+    assert(c == x);
+    assert(c.get_allocator() == a);
+}
+
+int main()
+{
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        test(std::deque<int, test_allocator<int> >(ab, an, test_allocator<int>(3)),
+                                                           test_allocator<int>(4));
+    }
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)),
+                                                            other_allocator<int>(4));
+    }
+#if __cplusplus >= 201103L
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        test(std::deque<int, min_allocator<int> >(ab, an, min_allocator<int>()),
+                                                          min_allocator<int>());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque()
+
+#include <deque>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+#include "../../../NotConstructible.h"
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void
+test()
+{
+    std::deque<T, Allocator> d;
+    assert(d.size() == 0);
+#if __cplusplus >= 201103L
+    std::deque<T, Allocator> d1 = {};
+    assert(d1.size() == 0);
+#endif
+}
+
+int main()
+{
+    test<int, std::allocator<int> >();
+    test<NotConstructible, stack_allocator<NotConstructible, 1> >();
+#if __cplusplus >= 201103L
+    test<int, min_allocator<int> >();
+    test<NotConstructible, min_allocator<NotConstructible> >();
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque()
+//        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::deque<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// ~deque() // implied noexcept;
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+#if __has_feature(cxx_noexcept)
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+    ~some_alloc() noexcept(false);
+};
+
+#endif
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::deque<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(initializer_list<value_type> il);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::deque<int> d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::deque<int, min_allocator<int>> d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(initializer_list<value_type> il, const Allocator& a = allocator_type());
+
+#include <deque>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::deque<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
+    assert(d.get_allocator() == test_allocator<int>(3));
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::deque<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
+    assert(d.get_allocator() == min_allocator<int>());
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// template <class InputIterator> deque(InputIterator f, InputIterator l);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+template <class InputIterator>
+void
+test(InputIterator f, InputIterator l)
+{
+    typedef typename std::iterator_traits<InputIterator>::value_type T;
+    typedef std::allocator<T> Allocator;
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    C d(f, l);
+    assert(d.size() == std::distance(f, l));
+    assert(distance(d.begin(), d.end()) == d.size());
+    for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
+        assert(*i == *f);
+}
+
+template <class Allocator, class InputIterator>
+void
+test(InputIterator f, InputIterator l)
+{
+    typedef typename std::iterator_traits<InputIterator>::value_type T;
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    C d(f, l);
+    assert(d.size() == std::distance(f, l));
+    assert(distance(d.begin(), d.end()) == d.size());
+    for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
+        assert(*i == *f);
+}
+
+int main()
+{
+    int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+    int* an = ab + sizeof(ab)/sizeof(ab[0]);
+    test(input_iterator<const int*>(ab), input_iterator<const int*>(an));
+    test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an));
+    test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an));
+    test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an));
+    test<stack_allocator<int, 4096> >(ab, an);
+#if __cplusplus >= 201103L
+    test<min_allocator<int> >(ab, an);
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// template <class InputIterator>
+//   deque(InputIterator f, InputIterator l, const allocator_type& a);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class InputIterator, class Allocator>
+void
+test(InputIterator f, InputIterator l, const Allocator& a)
+{
+    typedef typename std::iterator_traits<InputIterator>::value_type T;
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    C d(f, l, a);
+    assert(d.get_allocator() == a);
+    assert(d.size() == std::distance(f, l));
+    assert(distance(d.begin(), d.end()) == d.size());
+    for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
+        assert(*i == *f);
+}
+
+int main()
+{
+    int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+    int* an = ab + sizeof(ab)/sizeof(ab[0]);
+    test(input_iterator<const int*>(ab), input_iterator<const int*>(an), test_allocator<int>(3));
+    test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), test_allocator<int>(4));
+    test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), test_allocator<int>(5));
+    test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), test_allocator<int>(6));
+#if __cplusplus >= 201103L
+    test(input_iterator<const int*>(ab), input_iterator<const int*>(an), min_allocator<int>());
+    test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), min_allocator<int>());
+    test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), min_allocator<int>());
+    test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), min_allocator<int>());
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(deque&&);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef test_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(1));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(2));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3 = std::move(c1);
+        assert(c2 == c3);
+        assert(c1.size() == 0);
+        assert(c3.get_allocator() == c1.get_allocator());
+    }
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef other_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(1));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(2));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3 = std::move(c1);
+        assert(c2 == c3);
+        assert(c1.size() == 0);
+        assert(c3.get_allocator() == c1.get_allocator());
+    }
+#if __cplusplus >= 201103L
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef min_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A{});
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A{});
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3 = std::move(c1);
+        assert(c2 == c3);
+        assert(c1.size() == 0);
+        assert(c3.get_allocator() == c1.get_allocator());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(deque&& c, const allocator_type& a);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef test_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(1));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(1));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(std::move(c1), A(3));
+        assert(c2 == c3);
+        assert(c3.get_allocator() == A(3));
+        assert(c1.size() != 0);
+    }
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef test_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(1));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(1));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(std::move(c1), A(1));
+        assert(c2 == c3);
+        assert(c3.get_allocator() == A(1));
+        assert(c1.size() == 0);
+    }
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef other_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(1));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(1));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(std::move(c1), A(3));
+        assert(c2 == c3);
+        assert(c3.get_allocator() == A(3));
+        assert(c1.size() != 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef min_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A{});
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A{});
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(std::move(c1), A());
+        assert(c2 == c3);
+        assert(c3.get_allocator() == A());
+        assert(c1.size() == 0);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque& operator=(deque&& c);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef test_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(5));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(5));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(A(5));
+        c3 = std::move(c1);
+        assert(c2 == c3);
+        assert(c1.size() == 0);
+        assert(c3.get_allocator() == A(5));
+    }
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef test_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(5));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(5));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(A(6));
+        c3 = std::move(c1);
+        assert(c2 == c3);
+        assert(c1.size() != 0);
+        assert(c3.get_allocator() == A(6));
+    }
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef other_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A(5));
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A(5));
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(A(6));
+        c3 = std::move(c1);
+        assert(c2 == c3);
+        assert(c1.size() == 0);
+        assert(c3.get_allocator() == A(5));
+    }
+#if __cplusplus >= 201103L
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        typedef min_allocator<MoveOnly> A;
+        std::deque<MoveOnly, A> c1(A{});
+        for (int* p = ab; p < an; ++p)
+            c1.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c2(A{});
+        for (int* p = ab; p < an; ++p)
+            c2.push_back(MoveOnly(*p));
+        std::deque<MoveOnly, A> c3(A{});
+        c3 = std::move(c1);
+        assert(c2 == c3);
+        assert(c1.size() == 0);
+        assert(c3.get_allocator() == A());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque& operator=(deque&& c)
+//     noexcept(
+//          allocator_type::propagate_on_container_move_assignment::value &&
+//          is_nothrow_move_assignable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::deque<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(deque&&)
+//        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::deque<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque& operator=(const deque& c);
+
+#include <deque>
+#include <cassert>
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class C>
+void
+test(const C& x)
+{
+    C c;
+    c = x;
+    assert(c == x);
+}
+
+int main()
+{
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        test(std::deque<int>(ab, an));
+    }
+    {
+        std::deque<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+        std::deque<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+        l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == test_allocator<int>(3));
+    }
+    {
+        std::deque<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+        std::deque<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+        l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == other_allocator<int>(5));
+    }
+#if __cplusplus >= 201103L
+    {
+        int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
+        int* an = ab + sizeof(ab)/sizeof(ab[0]);
+        test(std::deque<int, min_allocator<int>>(ab, an));
+    }
+    {
+        std::deque<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+        std::deque<int, min_allocator<int> > l2(l, min_allocator<int>());
+        l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == min_allocator<int>());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque& operator=(initializer_list<value_type> il);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::deque<int> d;
+    d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::deque<int, min_allocator<int>> d;
+    d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    assert(d[0] == 3);
+    assert(d[1] == 4);
+    assert(d[2] == 5);
+    assert(d[3] == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,113 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// explicit deque(size_type n);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void
+test2(unsigned n)
+{
+#if _LIBCPP_STD_VER > 11
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    assert(DefaultOnly::count == 0);
+    {
+    C d(n, Allocator());
+    assert(DefaultOnly::count == n);
+    assert(d.size() == n);
+    assert(distance(d.begin(), d.end()) == d.size());
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
+        assert(*i == T());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    }
+    assert(DefaultOnly::count == 0);
+#endif
+}
+
+template <class T, class Allocator>
+void
+test1(unsigned n)
+{
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    assert(DefaultOnly::count == 0);
+    {
+    C d(n);
+    assert(DefaultOnly::count == n);
+    assert(d.size() == n);
+    assert(distance(d.begin(), d.end()) == d.size());
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
+        assert(*i == T());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    }
+    assert(DefaultOnly::count == 0);
+}
+
+template <class T, class Allocator>
+void
+test3(unsigned n, Allocator const &alloc = Allocator())
+{
+#if _LIBCPP_STD_VER > 11
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    {
+    C d(n, alloc);
+    assert(d.size() == n);
+    assert(d.get_allocator() == alloc);
+    }
+#endif
+}
+
+template <class T, class Allocator>
+void
+test(unsigned n)
+{
+    test1<T, Allocator> ( n );
+    test2<T, Allocator> ( n );
+}
+
+int main()
+{
+    test<DefaultOnly, std::allocator<DefaultOnly> >(0);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(1);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(10);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(1023);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(1024);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(1025);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(2047);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(2048);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(2049);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(4095);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(4096);
+    test<DefaultOnly, std::allocator<DefaultOnly> >(4097);
+
+    test1<DefaultOnly, stack_allocator<DefaultOnly, 4096> >(4095);
+
+#if __cplusplus >= 201103L
+    test<DefaultOnly, min_allocator<DefaultOnly> >(4095);
+#endif
+
+#if _LIBCPP_STD_VER > 11
+    test3<DefaultOnly, std::allocator<DefaultOnly>> (1023);
+    test3<int, std::allocator<int>>(1);
+    test3<int, min_allocator<int>> (3);
+#endif
+
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(size_type n, const value_type& v);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../stack_allocator.h"
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void
+test(unsigned n, const T& x)
+{
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    C d(n, x);
+    assert(d.size() == n);
+    assert(distance(d.begin(), d.end()) == d.size());
+    for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
+        assert(*i == x);
+}
+
+int main()
+{
+    test<int, std::allocator<int> >(0, 5);
+    test<int, std::allocator<int> >(1, 10);
+    test<int, std::allocator<int> >(10, 11);
+    test<int, std::allocator<int> >(1023, -11);
+    test<int, std::allocator<int> >(1024, 25);
+    test<int, std::allocator<int> >(1025, 0);
+    test<int, std::allocator<int> >(2047, 110);
+    test<int, std::allocator<int> >(2048, -500);
+    test<int, std::allocator<int> >(2049, 654);
+    test<int, std::allocator<int> >(4095, 78);
+    test<int, std::allocator<int> >(4096, 1165);
+    test<int, std::allocator<int> >(4097, 157);
+    test<int, stack_allocator<int, 4096> >(4095, 90);
+#if __cplusplus >= 201103L
+    test<int, min_allocator<int> >(4095, 90);
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque(size_type n, const value_type& v, const allocator_type& a);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void
+test(unsigned n, const T& x, const Allocator& a)
+{
+    typedef std::deque<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    C d(n, x, a);
+    assert(d.get_allocator() == a);
+    assert(d.size() == n);
+    assert(distance(d.begin(), d.end()) == d.size());
+    for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
+        assert(*i == x);
+}
+
+int main()
+{
+    {
+    std::allocator<int> a;
+    test(0, 5, a);
+    test(1, 10, a);
+    test(10, 11, a);
+    test(1023, -11, a);
+    test(1024, 25, a);
+    test(1025, 0, a);
+    test(2047, 110, a);
+    test(2048, -500, a);
+    test(2049, 654, a);
+    test(4095, 78, a);
+    test(4096, 1165, a);
+    test(4097, 157, a);
+    }
+#if __cplusplus >= 201103L
+    {
+    min_allocator<int> a;
+    test(0, 5, a);
+    test(1, 10, a);
+    test(10, 11, a);
+    test(1023, -11, a);
+    test(1024, 25, a);
+    test(1025, 0, a);
+    test(2047, 110, a);
+    test(2048, -500, a);
+    test(2049, 654, a);
+    test(4095, 78, a);
+    test(4096, 1165, a);
+    test(4097, 157, a);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// template <class... Args> iterator emplace(const_iterator p, Args&&... args);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "min_allocator.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(Emplaceable());
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(int P, C& c1)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    std::size_t c1_osize = c1.size();
+    CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize + 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    assert(*i == Emplaceable(1, 2.5));
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i <= 3; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1);
+        }
+    }
+    for (int i = N/2-1; i <= N/2+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1);
+        }
+    }
+    for (int i = N - 3; i <= N; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1);
+        }
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// template <class... Args> void emplace_back(Args&&... args);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "min_allocator.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(Emplaceable());
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1)
+{
+    typedef typename C::iterator I;
+    std::size_t c1_osize = c1.size();
+    c1.emplace_back(Emplaceable(1, 2.5));
+    assert(c1.size() == c1_osize + 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    I i = c1.end();
+    assert(*--i == Emplaceable(1, 2.5));
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    C c1 = make<C>(N, start);
+    test(c1);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// template <class... Args> void emplace_front(Args&&... args);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "min_allocator.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(Emplaceable());
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1)
+{
+    typedef typename C::iterator I;
+    std::size_t c1_osize = c1.size();
+    c1.emplace_front(Emplaceable(1, 2.5));
+    assert(c1.size() == c1_osize + 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    I i = c1.begin();
+    assert(*i == Emplaceable(1, 2.5));
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    C c1 = make<C>(N, start);
+    test(c1);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<Emplaceable> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// iterator erase(const_iterator p)
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(int P, C& c1)
+{
+    typedef typename C::iterator I;
+    assert(P < c1.size());
+    std::size_t c1_osize = c1.size();
+    I i = c1.erase(c1.cbegin() + P);
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize - 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    i = c1.begin();
+    int j = 0;
+    for (; j < P; ++j, ++i)
+        assert(*i == j);
+    for (++j; j < c1_osize; ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
+    for (int p = 0; p < N; p += pstep)
+    {
+        C c1 = make<C>(N, start);
+        test(p, c1);
+    }
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <deque>
+
+// iterator erase(const_iterator f, const_iterator l)
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(int P, C& c1, int size)
+{
+    typedef typename C::iterator I;
+    assert(P + size <= c1.size());
+    std::size_t c1_osize = c1.size();
+    I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size));
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize - size);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    i = c1.begin();
+    int j = 0;
+    for (; j < P; ++j, ++i)
+        assert(*i == j);
+    for (j += size; j < c1_osize; ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    int pstep = std::max(N / std::max(std::min(N, 10), 1), 1);
+    for (int p = 0; p <= N; p += pstep)
+    {
+        int sstep = std::max((N - p) / std::max(std::min(N - p, 10), 1), 1);
+        for (int s = 0; s <= N - p; s += sstep)
+        {
+            C c1 = make<C>(N, start);
+            test(p, c1, s);
+        }
+    }
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// iterator insert(const_iterator p, initializer_list<value_type> il);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::deque<int> d(10, 1);
+    std::deque<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
+    assert(d.size() == 14);
+    assert(i == d.begin() + 2);
+    assert(d[0] == 1);
+    assert(d[1] == 1);
+    assert(d[2] == 3);
+    assert(d[3] == 4);
+    assert(d[4] == 5);
+    assert(d[5] == 6);
+    assert(d[6] == 1);
+    assert(d[7] == 1);
+    assert(d[8] == 1);
+    assert(d[9] == 1);
+    assert(d[10] == 1);
+    assert(d[11] == 1);
+    assert(d[12] == 1);
+    assert(d[13] == 1);
+    }
+    {
+    std::deque<int, min_allocator<int>> d(10, 1);
+    std::deque<int, min_allocator<int>>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
+    assert(d.size() == 14);
+    assert(i == d.begin() + 2);
+    assert(d[0] == 1);
+    assert(d[1] == 1);
+    assert(d[2] == 3);
+    assert(d[3] == 4);
+    assert(d[4] == 5);
+    assert(d[5] == 6);
+    assert(d[6] == 1);
+    assert(d[7] == 1);
+    assert(d[8] == 1);
+    assert(d[9] == 1);
+    assert(d[10] == 1);
+    assert(d[11] == 1);
+    assert(d[12] == 1);
+    assert(d[13] == 1);
+    }
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,256 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <deque>
+
+// template <class InputIterator>
+//   iterator insert (const_iterator p, InputIterator f, InputIterator l);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "../../../MoveOnly.h"
+#include "../../../stack_allocator.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(int P, C& c1, const C& c2)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    typedef bidirectional_iterator<CI> BCI;
+    std::size_t c1_osize = c1.size();
+    CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize + c2.size());
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    i = c1.begin();
+    for (int j = 0; j < P; ++j, ++i)
+        assert(*i == j);
+    for (int j = 0; j < c2.size(); ++j, ++i)
+        assert(*i == j);
+    for (int j = P; j < c1_osize; ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N, int M)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i <= 3; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            test(i, c1, c2);
+        }
+    }
+    for (int i = M-1; i <= M+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            test(i, c1, c2);
+        }
+    }
+    for (int i = N/2-1; i <= N/2+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            test(i, c1, c2);
+        }
+    }
+    for (int i = N - M - 1; i <= N - M + 1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            test(i, c1, c2);
+        }
+    }
+    for (int i = N - M - 1; i <= N - M + 1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            test(i, c1, c2);
+        }
+    }
+    for (int i = N - 3; i <= N; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            test(i, c1, c2);
+        }
+    }
+}
+
+template <class C>
+void
+testI(int P, C& c1, const C& c2)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    typedef input_iterator<CI> ICI;
+    std::size_t c1_osize = c1.size();
+    CI i = c1.insert(c1.begin() + P, ICI(c2.begin()), ICI(c2.end()));
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize + c2.size());
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    i = c1.begin();
+    for (int j = 0; j < P; ++j, ++i)
+        assert(*i == j);
+    for (int j = 0; j < c2.size(); ++j, ++i)
+        assert(*i == j);
+    for (int j = P; j < c1_osize; ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testNI(int start, int N, int M)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i <= 3; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            testI(i, c1, c2);
+        }
+    }
+    for (int i = M-1; i <= M+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            testI(i, c1, c2);
+        }
+    }
+    for (int i = N/2-1; i <= N/2+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            testI(i, c1, c2);
+        }
+    }
+    for (int i = N - M - 1; i <= N - M + 1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            testI(i, c1, c2);
+        }
+    }
+    for (int i = N - 3; i <= N; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            C c2 = make<C>(M);
+            testI(i, c1, c2);
+        }
+    }
+}
+
+template <class C>
+void
+test_move()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    C c;
+    typedef typename C::const_iterator CI;
+    {
+        MoveOnly mo(0);
+        typedef MoveOnly* I;
+        c.insert(c.end(), std::move_iterator<I>(&mo), std::move_iterator<I>(&mo+1));
+    }
+    int j = 0;
+    for (CI i = c.begin(); i != c.end(); ++i, ++j)
+        assert(*i == MoveOnly(j));
+    {
+        MoveOnly mo(1);
+        typedef input_iterator<MoveOnly*> I;
+        c.insert(c.end(), std::move_iterator<I>(I(&mo)), std::move_iterator<I>(I(&mo+1)));
+    }
+    j = 0;
+    for (CI i = c.begin(); i != c.end(); ++i, ++j)
+        assert(*i == MoveOnly(j));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+    testNI<std::deque<int> >(1500, 2000, 1000);
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_move<std::deque<MoveOnly, stack_allocator<MoveOnly, 2000> > >();
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+    testNI<std::deque<int> >(1500, 2000, 1000);
+    test_move<std::deque<MoveOnly, min_allocator<MoveOnly> > >();
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// iterator insert (const_iterator p, value_type&& v);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(MoveOnly(i));
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(int P, C& c1, int x)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    std::size_t c1_osize = c1.size();
+    CI i = c1.insert(c1.begin() + P, MoveOnly(x));
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize + 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    i = c1.begin();
+    for (int j = 0; j < P; ++j, ++i)
+        assert(*i == MoveOnly(j));
+    assert(*i == MoveOnly(x));
+    ++i;
+    for (int j = P; j < c1_osize; ++j, ++i)
+        assert(*i == MoveOnly(j));
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i <= 3; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, -10);
+        }
+    }
+    for (int i = N/2-1; i <= N/2+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, -10);
+        }
+    }
+    for (int i = N - 3; i <= N; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, -10);
+        }
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<MoveOnly> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,159 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// <deque>
+
+// iterator insert (const_iterator p, size_type n, const value_type& v);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(int P, C& c1, int size, int x)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    std::size_t c1_osize = c1.size();
+    CI i = c1.insert(c1.begin() + P, size, x);
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize + size);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    i = c1.begin();
+    for (int j = 0; j < P; ++j, ++i)
+        assert(*i == j);
+    for (int j = 0; j < size; ++j, ++i)
+        assert(*i == x);
+    for (int j = P; j < c1_osize; ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N, int M)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i <= 3; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, M, -10);
+        }
+    }
+    for (int i = M-1; i <= M+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, M, -10);
+        }
+    }
+    for (int i = N/2-1; i <= N/2+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, M, -10);
+        }
+    }
+    for (int i = N - M - 1; i <= N - M + 1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, M, -10);
+        }
+    }
+    for (int i = N - 3; i <= N; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, M, -10);
+        }
+    }
+}
+
+template <class C>
+void
+self_reference_test()
+{
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i < 20; ++i)
+    {
+        for (int j = 0; j < 20; ++j)
+        {
+            C c = make<C>(20);
+            CI it = c.cbegin() + i;
+            CI jt = c.cbegin() + j;
+            c.insert(it, 5, *jt);
+            assert(c.size() == 25);
+            assert(distance(c.begin(), c.end()) == c.size());
+            it = c.cbegin();
+            for (int k = 0; k < i; ++k, ++it)
+                assert(*it == k);
+            for (int k = 0; k < 5; ++k, ++it)
+                assert(*it == j);
+            for (int k = i; k < 20; ++k, ++it)
+                assert(*it == k);
+        }
+    }
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+    self_reference_test<std::deque<int> >();
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            for (int k = 0; k < N; ++k)
+                testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+    self_reference_test<std::deque<int, min_allocator<int>> >();
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,139 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// iterator insert (const_iterator p, const value_type& v);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(int P, C& c1, int x)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    std::size_t c1_osize = c1.size();
+    CI i = c1.insert(c1.begin() + P, x);
+    assert(i == c1.begin() + P);
+    assert(c1.size() == c1_osize + 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    i = c1.begin();
+    for (int j = 0; j < P; ++j, ++i)
+        assert(*i == j);
+    assert(*i == x);
+    ++i;
+    for (int j = P; j < c1_osize; ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i <= 3; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, -10);
+        }
+    }
+    for (int i = N/2-1; i <= N/2+1; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, -10);
+        }
+    }
+    for (int i = N - 3; i <= N; ++i)
+    {
+        if (0 <= i && i <= N)
+        {
+            C c1 = make<C>(N, start);
+            test(i, c1, -10);
+        }
+    }
+}
+
+template <class C>
+void
+self_reference_test()
+{
+    typedef typename C::const_iterator CI;
+    for (int i = 0; i < 20; ++i)
+    {
+        for (int j = 0; j < 20; ++j)
+        {
+            C c = make<C>(20);
+            CI it = c.cbegin() + i;
+            CI jt = c.cbegin() + j;
+            c.insert(it, *jt);
+            assert(c.size() == 21);
+            assert(distance(c.begin(), c.end()) == c.size());
+            it = c.cbegin();
+            for (int k = 0; k < i; ++k, ++it)
+                assert(*it == k);
+            assert(*it == j);
+            ++it;
+            for (int k = i; k < 20; ++k, ++it)
+                assert(*it == k);
+        }
+    }
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    self_reference_test<std::deque<int> >();
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    self_reference_test<std::deque<int, min_allocator<int>> >();
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void pop_back()
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1)
+{
+    typedef typename C::iterator I;
+    std::size_t c1_osize = c1.size();
+    c1.pop_back();
+    assert(c1.size() == c1_osize - 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    I i = c1.begin();
+    for (int j = 0; j < c1.size(); ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    if (N != 0)
+    {
+        C c1 = make<C>(N, start);
+        test(c1);
+    }
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void pop_front()
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1)
+{
+    typedef typename C::iterator I;
+    std::size_t c1_osize = c1.size();
+    c1.pop_front();
+    assert(c1.size() == c1_osize - 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    I i = c1.begin();
+    for (int j = 1; j < c1.size(); ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    if (N != 0)
+    {
+        C c1 = make<C>(N, start);
+        test(c1);
+    }
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void push_back(const value_type& v);
+// void pop_back();
+// void pop_front();
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void test(int size)
+{
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int j = 0; j < N; ++j)
+    {
+        C c = make<C>(size, rng[j]);
+        typename C::const_iterator it = c.begin();
+        for (int i = 0; i < size; ++i, ++it)
+            assert(*it == i);
+    }
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int j = 0; j < N; ++j)
+        test<std::deque<int> >(rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int j = 0; j < N; ++j)
+        test<std::deque<int, min_allocator<int>> >(rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void push_back(const value_type& x);
+
+#include <deque>
+#include <cassert>
+
+// Flag that makes the copy constructor for CMyClass throw an exception
+static bool gCopyConstructorShouldThow = false;
+
+
+class CMyClass {
+    public: CMyClass(int tag);
+    public: CMyClass(const CMyClass& iOther);
+    public: ~CMyClass();
+
+    bool equal(const CMyClass &rhs) const
+        { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
+    private:
+        int fMagicValue;
+        int fTag;
+        
+    private: static int kStartedConstructionMagicValue;
+    private: static int kFinishedConstructionMagicValue;
+};
+
+// Value for fMagicValue when the constructor has started running, but not yet finished
+int CMyClass::kStartedConstructionMagicValue = 0;
+// Value for fMagicValue when the constructor has finished running
+int CMyClass::kFinishedConstructionMagicValue = 12345;
+
+CMyClass::CMyClass(int tag) :
+    fMagicValue(kStartedConstructionMagicValue), fTag(tag)
+{
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::CMyClass(const CMyClass& iOther) :
+    fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
+{
+    // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+    if (gCopyConstructorShouldThow) {
+        throw std::exception();
+    }
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::~CMyClass() {
+    // Only instances for which the constructor has finished running should be destructed
+    assert(fMagicValue == kFinishedConstructionMagicValue);
+}
+
+bool operator==(const CMyClass &lhs, const CMyClass &rhs) { return lhs.equal(rhs); }
+
+int main()
+{
+    CMyClass instance(42);
+    std::deque<CMyClass> vec;
+
+    vec.push_back(instance);
+    std::deque<CMyClass> vec2(vec);
+
+    gCopyConstructorShouldThow = true;
+    try {
+        vec.push_back(instance);
+    }
+    catch (...) {
+        assert(vec==vec2);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void push_back(value_type&& v);
+// void pop_back();
+// void pop_front();
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(MoveOnly(i));
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void test(int size)
+{
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int j = 0; j < N; ++j)
+    {
+        C c = make<C>(size, rng[j]);
+        typename C::const_iterator it = c.begin();
+        for (int i = 0; i < size; ++i, ++it)
+            assert(*it == MoveOnly(i));
+    }
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int j = 0; j < N; ++j)
+        test<std::deque<MoveOnly> >(rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int j = 0; j < N; ++j)
+        test<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[j]);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void push_front(const value_type& v);
+
+#include <deque>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1, int x)
+{
+    typedef typename C::iterator I;
+    std::size_t c1_osize = c1.size();
+    c1.push_front(x);
+    assert(c1.size() == c1_osize + 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    I i = c1.begin();
+    assert(*i == x);
+    ++i;
+    for (int j = 0; j < c1_osize; ++j, ++i)
+        assert(*i == j);
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    C c1 = make<C>(N, start);
+    test(c1, -10);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+   {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void push_front(const value_type& x);
+
+#include <deque>
+#include <cassert>
+
+// Flag that makes the copy constructor for CMyClass throw an exception
+static bool gCopyConstructorShouldThow = false;
+
+
+class CMyClass {
+    public: CMyClass(int tag);
+    public: CMyClass(const CMyClass& iOther);
+    public: ~CMyClass();
+
+    bool equal(const CMyClass &rhs) const
+        { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; }
+    private:
+        int fMagicValue;
+        int fTag;
+        
+    private: static int kStartedConstructionMagicValue;
+    private: static int kFinishedConstructionMagicValue;
+};
+
+// Value for fMagicValue when the constructor has started running, but not yet finished
+int CMyClass::kStartedConstructionMagicValue = 0;
+// Value for fMagicValue when the constructor has finished running
+int CMyClass::kFinishedConstructionMagicValue = 12345;
+
+CMyClass::CMyClass(int tag) :
+    fMagicValue(kStartedConstructionMagicValue), fTag(tag)
+{
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::CMyClass(const CMyClass& iOther) :
+    fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
+{
+    // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+    if (gCopyConstructorShouldThow) {
+        throw std::exception();
+    }
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::~CMyClass() {
+    // Only instances for which the constructor has finished running should be destructed
+    assert(fMagicValue == kFinishedConstructionMagicValue);
+}
+
+bool operator==(const CMyClass &lhs, const CMyClass &rhs) { return lhs.equal(rhs); }
+
+int main()
+{
+    CMyClass instance(42);
+    std::deque<CMyClass> vec;
+
+    vec.push_front(instance);
+    std::deque<CMyClass> vec2(vec);
+
+    gCopyConstructorShouldThow = true;
+    try {
+        vec.push_front(instance);
+    }
+    catch (...) {
+        assert(vec==vec2);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void push_front(value_type&& v);
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(MoveOnly(i));
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void
+test(C& c1, int x)
+{
+    typedef typename C::iterator I;
+    std::size_t c1_osize = c1.size();
+    c1.push_front(MoveOnly(x));
+    assert(c1.size() == c1_osize + 1);
+    assert(distance(c1.begin(), c1.end()) == c1.size());
+    I i = c1.begin();
+    assert(*i == MoveOnly(x));
+    ++i;
+    for (int j = 0; j < c1_osize; ++j, ++i)
+        assert(*i == MoveOnly(j));
+}
+
+template <class C>
+void
+testN(int start, int N)
+{
+    C c1 = make<C>(N, start);
+    test(c1, -10);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<MoveOnly> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Optimization for deque::iterators
+
+// template <class InputIterator, class OutputIterator>
+//   OutputIterator
+//   copy(InputIterator first, InputIterator last, OutputIterator result);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void testN(int start, int N)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    typedef random_access_iterator<I> RAI;
+    typedef random_access_iterator<CI> RACI;
+    typedef input_iterator<CI> ICI;
+    C c1 = make<C>(N, start);
+    C c2 = make<C>(N);
+    assert(std::copy(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
+    assert(c1 == c2);
+    assert(std::copy(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
+    assert(c1 == c2);
+    assert(std::copy(c1.cbegin(), c1.cend(), RAI(c2.begin())) == RAI(c2.end()));
+    assert(c1 == c2);
+    assert(std::copy(c2.cbegin(), c2.cend(), RAI(c1.begin())) == RAI(c1.end()));
+    assert(c1 == c2);
+    assert(std::copy(RACI(c1.cbegin()), RACI(c1.cend()), c2.begin()) == c2.end());
+    assert(c1 == c2);
+    assert(std::copy(ICI(c2.cbegin()), ICI(c2.cend()), c1.begin()) == c1.end());
+    assert(c1 == c2);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Optimization for deque::iterators
+
+// template <class InputIterator, class OutputIterator>
+//   OutputIterator
+//   copy_backward(InputIterator first, InputIterator last, OutputIterator result);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void testN(int start, int N)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    typedef random_access_iterator<I> RAI;
+    typedef random_access_iterator<CI> RACI;
+    C c1 = make<C>(N, start);
+    C c2 = make<C>(N);
+    assert(std::copy_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
+    assert(c1 == c2);
+    assert(std::copy_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
+    assert(c1 == c2);
+    assert(std::copy_backward(c1.cbegin(), c1.cend(), RAI(c2.end())) == RAI(c2.begin()));
+    assert(c1 == c2);
+    assert(std::copy_backward(c2.cbegin(), c2.cend(), RAI(c1.end())) == RAI(c1.begin()));
+    assert(c1 == c2);
+    assert(std::copy_backward(RACI(c1.cbegin()), RACI(c1.cend()), c2.end()) == c2.begin());
+    assert(c1 == c2);
+    assert(std::copy_backward(RACI(c2.cbegin()), RACI(c2.cend()), c1.end()) == c1.begin());
+    assert(c1 == c2);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.special/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.special/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.special/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.special/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Optimization for deque::iterators
+
+// template <class InputIterator, class OutputIterator>
+//   OutputIterator
+//   move(InputIterator first, InputIterator last, OutputIterator result);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void testN(int start, int N)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    typedef random_access_iterator<I> RAI;
+    typedef random_access_iterator<CI> RACI;
+    C c1 = make<C>(N, start);
+    C c2 = make<C>(N);
+    assert(std::move(c1.cbegin(), c1.cend(), c2.begin()) == c2.end());
+    assert(c1 == c2);
+    assert(std::move(c2.cbegin(), c2.cend(), c1.begin()) == c1.end());
+    assert(c1 == c2);
+    assert(std::move(c1.cbegin(), c1.cend(), RAI(c2.begin())) == RAI(c2.end()));
+    assert(c1 == c2);
+    assert(std::move(c2.cbegin(), c2.cend(), RAI(c1.begin())) == RAI(c1.end()));
+    assert(c1 == c2);
+    assert(std::move(RACI(c1.cbegin()), RACI(c1.cend()), c2.begin()) == c2.end());
+    assert(c1 == c2);
+    assert(std::move(RACI(c2.cbegin()), RACI(c2.cend()), c1.begin()) == c1.end());
+    assert(c1 == c2);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Optimization for deque::iterators
+
+// template <class InputIterator, class OutputIterator>
+//   OutputIterator
+//   move_backward(InputIterator first, InputIterator last, OutputIterator result);
+
+#include <deque>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void testN(int start, int N)
+{
+    typedef typename C::iterator I;
+    typedef typename C::const_iterator CI;
+    typedef random_access_iterator<I> RAI;
+    typedef random_access_iterator<CI> RACI;
+    C c1 = make<C>(N, start);
+    C c2 = make<C>(N);
+    assert(std::move_backward(c1.cbegin(), c1.cend(), c2.end()) == c2.begin());
+    assert(c1 == c2);
+    assert(std::move_backward(c2.cbegin(), c2.cend(), c1.end()) == c1.begin());
+    assert(c1 == c2);
+    assert(std::move_backward(c1.cbegin(), c1.cend(), RAI(c2.end())) == RAI(c2.begin()));
+    assert(c1 == c2);
+    assert(std::move_backward(c2.cbegin(), c2.cend(), RAI(c1.end())) == RAI(c1.begin()));
+    assert(c1 == c2);
+    assert(std::move_backward(RACI(c1.cbegin()), RACI(c1.cend()), c2.end()) == c2.begin());
+    assert(c1 == c2);
+    assert(std::move_backward(RACI(c2.cbegin()), RACI(c2.cend()), c1.end()) == c1.begin());
+    assert(c1 == c2);
+}
+
+int main()
+{
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int> >(rng[i], rng[j]);
+    }
+#if __cplusplus >= 201103L
+    {
+    int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+    const int N = sizeof(rng)/sizeof(rng[0]);
+    for (int i = 0; i < N; ++i)
+        for (int j = 0; j < N; ++j)
+            testN<std::deque<int, min_allocator<int> > >(rng[i], rng[j]);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,110 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// template <class T, class A>
+//   void swap(deque<T, A>& x, deque<T, A>& y);
+
+#include <deque>
+#include <cassert>
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class C>
+C
+make(int size, int start = 0 )
+{
+    const int b = 4096 / sizeof(int);
+    int init = 0;
+    if (start > 0)
+    {
+        init = (start+1) / b + ((start+1) % b != 0);
+        init *= b;
+        --init;
+    }
+    C c(init, 0);
+    for (int i = 0; i < init-start; ++i)
+        c.pop_back();
+    for (int i = 0; i < size; ++i)
+        c.push_back(i);
+    for (int i = 0; i < start; ++i)
+        c.pop_front();
+    return c;
+};
+
+template <class C>
+void testN(int start, int N, int M)
+{
+    C c1 = make<C>(N, start);
+    C c2 = make<C>(M);
+    C c1_save = c1;
+    C c2_save = c2;
+    swap(c1, c2);
+    assert(c1 == c2_save);
+    assert(c2 == c1_save);
+}
+
+int main()
+{
+    {
+        int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+        const int N = sizeof(rng)/sizeof(rng[0]);
+        for (int i = 0; i < N; ++i)
+            for (int j = 0; j < N; ++j)
+                for (int k = 0; k < N; ++k)
+                    testN<std::deque<int> >(rng[i], rng[j], rng[k]);
+    }
+    {
+        int a1[] = {1, 3, 7, 9, 10};
+        int a2[] = {0, 2, 4, 5, 6, 8, 11};
+        typedef test_allocator<int> A;
+        std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
+        std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+        swap(c1, c2);
+        assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
+        assert(c1.get_allocator() == A(1));
+        assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+        assert(c2.get_allocator() == A(2));
+    }
+    {
+        int a1[] = {1, 3, 7, 9, 10};
+        int a2[] = {0, 2, 4, 5, 6, 8, 11};
+        typedef other_allocator<int> A;
+        std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
+        std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+        swap(c1, c2);
+        assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
+        assert(c1.get_allocator() == A(2));
+        assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+        assert(c2.get_allocator() == A(1));
+    }
+#if __cplusplus >= 201103L
+    {
+        int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
+        const int N = sizeof(rng)/sizeof(rng[0]);
+        for (int i = 0; i < N; ++i)
+            for (int j = 0; j < N; ++j)
+                for (int k = 0; k < N; ++k)
+                    testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j], rng[k]);
+    }
+    {
+        int a1[] = {1, 3, 7, 9, 10};
+        int a2[] = {0, 2, 4, 5, 6, 8, 11};
+        typedef min_allocator<int> A;
+        std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A());
+        std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A());
+        swap(c1, c2);
+        assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
+        assert(c1.get_allocator() == A());
+        assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+        assert(c2.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void swap(deque& c)
+//     noexcept(!allocator_type::propagate_on_container_swap::value ||
+//              __is_nothrow_swappable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <deque>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    
+    some_alloc() {}
+    some_alloc(const some_alloc&);
+    void deallocate(void*, unsigned) {}
+
+    typedef std::true_type propagate_on_container_swap;
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::deque<MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
+        C c1, c2;
+        static_assert(!noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/iterators.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/iterators.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/iterators.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Test nested types and default template args:
+
+// template <class T, class Allocator = allocator<T> >
+// class deque;
+
+// iterator, const_iterator
+
+#include <deque>
+#include <iterator>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::deque<int> C;
+    C c;
+    C::iterator i;
+    i = c.begin();
+    C::const_iterator j;
+    j = c.cbegin();
+    assert(i == j);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::deque<int, min_allocator<int>> C;
+    C c;
+    C::iterator i;
+    i = c.begin();
+    C::const_iterator j;
+    j = c.cbegin();
+    assert(i == j);
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    { // N3644 testing
+        std::deque<int>::iterator ii1{}, ii2{};
+        std::deque<int>::iterator ii4 = ii1;
+        std::deque<int>::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+
+        assert (!(ii1 != ii2 ));
+
+        assert ( (ii1 == cii ));
+        assert ( (cii == ii1 ));
+        assert (!(ii1 != cii ));
+        assert (!(cii != ii1 ));
+        assert (!(ii1 <  cii ));
+        assert (!(cii <  ii1 ));
+        assert ( (ii1 <= cii ));
+        assert ( (cii <= ii1 ));
+        assert (!(ii1 >  cii ));
+        assert (!(cii >  ii1 ));
+        assert ( (ii1 >= cii ));
+        assert ( (cii >= ii1 ));
+        assert (cii - ii1 == 0);
+        assert (ii1 - cii == 0);
+        
+//         std::deque<int> c;
+//         assert ( ii1 != c.cbegin());
+//         assert ( cii != c.begin());
+//         assert ( cii != c.cend());
+//         assert ( ii1 != c.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Test nested types and default template args:
+
+// template <class T, class Allocator = allocator<T> >
+// class deque
+// {
+// public:
+//     typedef T                                        value_type;
+//     typedef Allocator                                allocator_type;
+//     typedef typename allocator_type::reference       reference;
+//     typedef typename allocator_type::const_reference const_reference;
+//     typedef implementation-defined                   iterator;
+//     typedef implementation-defined                   const_iterator;
+//     typedef typename allocator_type::size_type       size_type;
+//     typedef typename allocator_type::difference_type difference_type;
+//     typedef typename allocator_type::pointer         pointer;
+//     typedef typename allocator_type::const_pointer   const_pointer;
+//     typedef std::reverse_iterator<iterator>          reverse_iterator;
+//     typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+// };
+
+#include <deque>
+#include <iterator>
+#include <type_traits>
+
+#include "test_allocator.h"
+#include "../../Copyable.h"
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void
+test()
+{
+    typedef std::deque<T, Allocator> C;
+
+    static_assert((std::is_same<typename C::value_type, T>::value), "");
+    static_assert((std::is_same<typename C::value_type, typename Allocator::value_type>::value), "");
+    static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
+    static_assert((std::is_same<typename C::size_type, typename Allocator::size_type>::value), "");
+    static_assert((std::is_same<typename C::difference_type, typename Allocator::difference_type>::value), "");
+    static_assert((std::is_same<typename C::reference, typename Allocator::reference>::value), "");
+    static_assert((std::is_same<typename C::const_reference, typename Allocator::const_reference>::value), "");
+    static_assert((std::is_same<typename C::pointer, typename Allocator::pointer>::value), "");
+    static_assert((std::is_same<typename C::const_pointer, typename Allocator::const_pointer>::value), "");
+    static_assert((std::is_same<
+        typename std::iterator_traits<typename C::iterator>::iterator_category,
+        std::random_access_iterator_tag>::value), "");
+    static_assert((std::is_same<
+        typename std::iterator_traits<typename C::const_iterator>::iterator_category,
+        std::random_access_iterator_tag>::value), "");
+    static_assert((std::is_same<
+        typename C::reverse_iterator,
+        std::reverse_iterator<typename C::iterator> >::value), "");
+    static_assert((std::is_same<
+        typename C::const_reverse_iterator,
+        std::reverse_iterator<typename C::const_iterator> >::value), "");
+}
+
+int main()
+{
+    test<int, test_allocator<int> >();
+    test<int*, std::allocator<int*> >();
+    test<Copyable, test_allocator<Copyable> >();
+    static_assert((std::is_same<std::deque<char>::allocator_type,
+                                std::allocator<char> >::value), "");
+#if __cplusplus >= 201103L
+    {
+        typedef std::deque<short, min_allocator<short>> C;
+        static_assert((std::is_same<C::value_type, short>::value), "");
+        static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+        static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+        static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+        static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+        static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+//  min_allocator doesn't have a size_type, so one gets synthesized
+        static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
+        static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/deque/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/version.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/deque/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+#include <deque>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.cons
+
+// template <class Alloc>
+//   dynarray(size_type c, const Alloc& alloc);
+// template <class Alloc>
+//   dynarray(size_type c, const T& v, const Alloc& alloc);
+// template <class Alloc>
+//   dynarray(const dynarray& d, const Alloc& alloc);
+// template <class Alloc>
+//   dynarray(initializer_list<T>, const Alloc& alloc);
+
+// ~dynarray();
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+#include "test_allocator.h"
+
+using std::experimental::dynarray;
+
+template <class T, class Allocator>
+void check_allocator ( const dynarray<T> &dyn, const Allocator &alloc ) {
+    for ( int i = 0; i < dyn.size (); ++i )
+        assert ( dyn[i].get_allocator() == alloc );
+}
+
+template <class T, class Allocator>
+void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( vals, alloc );
+    assert ( d1.size () == vals.size() );
+    assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
+    check_allocator ( d1, alloc );
+    }
+
+
+template <class T, class Allocator>
+void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( 4, alloc1 );
+    assert ( d1.size () == 4 );
+    assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
+    check_allocator ( d1, alloc1 );
+
+    dynA d2 ( 7, val, alloc1 );
+    assert ( d2.size () == 7 );
+    assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } ));
+    check_allocator ( d2, alloc1 );
+
+    dynA d3 ( d2, alloc2 );
+    assert ( d3.size () == 7 );
+    assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));   
+    check_allocator ( d3, alloc2 );
+    }
+
+int main()
+{
+//  This test is waiting on the resolution of LWG issue #2235 
+//     typedef test_allocator<char> Alloc;
+//     typedef std::basic_string<char, std::char_traits<char>, Alloc> nstr;
+// 
+//     test ( nstr("fourteen"), Alloc(3), Alloc(4) );
+//     test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6));
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,95 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.cons
+
+// explicit dynarray(size_type c);
+// dynarray(size_type c, const T& v);
+// dynarray(initializer_list<T>);
+// dynarray(const dynarray& d);
+
+// ~dynarray();
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void test ( const std::initializer_list<T> &vals ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( vals );
+    assert ( d1.size () == vals.size() );
+    assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
+    }
+
+
+template <class T>
+void test ( const T &val ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( 4 );
+    assert ( d1.size () == 4 );
+    assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
+
+    dynA d2 ( 7, val );
+    assert ( d2.size () == 7 );
+    assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } ));
+
+    dynA d3 ( d2 );
+    assert ( d3.size () == 7 );
+    assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));   
+    }
+
+void test_bad_length () {
+    try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) + 1 ); }
+    catch ( std::bad_array_length & ) { return ; }
+    assert ( false );
+    }
+
+void test_bad_alloc () {
+    try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) - 1 ); }
+    catch ( std::bad_alloc & ) { return ; }
+    assert ( false );
+    }
+
+int main()
+{
+//  test<int> ( 14 );       // ints don't get default initialized
+    test<long> ( 0 );
+    test<double> ( 14.0 );
+    test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
+    test<std::string> ( "fourteen" );
+    
+    test ( { 1, 1, 2, 3, 5, 8 } );
+    test ( { 1., 1., 2., 3., 5., 8. } );
+    test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), 
+                std::string("5"), std::string("8")} );
+    
+//  Make sure we don't pick up the Allocator version here
+    dynarray<long> d1 ( 20, 3 );
+    assert ( d1.size() == 20 );
+    assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return item == 3L; } ));
+
+    test_bad_length ();
+    test_bad_alloc ();
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.data/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.data/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.data/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.data/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.data
+
+// T* data() noexcept;
+// const T* data() const noexcept;
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void dyn_test_const ( const dynarray<T> &dyn ) {
+    const T *data = dyn.data ();
+    assert ( data != NULL );
+    assert ( std::equal ( dyn.begin(), dyn.end(), data ));
+    }
+
+template <class T>
+void dyn_test ( dynarray<T> &dyn ) {
+    T *data = dyn.data ();
+    assert ( data != NULL );
+    assert ( std::equal ( dyn.begin(), dyn.end(), data ));
+    }
+
+    
+
+template <class T>
+void test ( const T &val ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( 4 );
+    dyn_test ( d1 );
+    dyn_test_const ( d1 );
+    
+    dynA d2 ( 7, val );
+    dyn_test ( d2 );
+    dyn_test_const ( d2 );
+    }
+
+int main()
+{
+    test<int> ( 14 );
+    test<double> ( 14.0 );
+    test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
+    test<std::string> ( "fourteen" );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.data
+
+// void fill(const T& v);
+// const T* data() const noexcept;
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void test ( const T &val ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( 4 );
+    d1.fill ( val );
+    assert ( std::all_of ( d1.begin (), d1.end (), 
+                    [&val]( const T &item ){ return item == val; } ));  
+    }
+
+int main()
+{
+    test<int> ( 14 );
+    test<double> ( 14.0 );
+    test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
+    test<std::string> ( "fourteen" );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/at.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/at.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/at.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.overview
+
+// const_reference at(size_type n) const;
+//       reference at(size_type n);
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void dyn_at_fail ( dynarray<T> &dyn, size_t sz ) {
+    try { dyn.at (sz); }
+    catch (const std::out_of_range &) { return; }
+    assert ( false );
+    }
+
+template <class T>
+void dyn_at_fail_const ( const dynarray<T> &dyn, size_t sz ) {
+    try { dyn.at (sz); }
+    catch (const std::out_of_range &) { return; }
+    assert ( false );
+    }
+
+
+template <class T>
+void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+    const T *data = dyn.data ();
+    auto it = vals.begin ();
+    for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
+        assert ( data + i == &dyn.at(i));
+        assert ( *it == dyn.at(i));
+        }
+
+    dyn_at_fail_const ( dyn, dyn.size ());
+    dyn_at_fail_const ( dyn, 2*dyn.size ());
+    dyn_at_fail_const ( dyn, size_t (-1));
+    }
+
+template <class T>
+void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+    T *data = dyn.data ();
+    auto it = vals.begin ();
+    for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
+        assert ( data + i == &dyn.at(i));
+        assert ( *it == dyn.at(i));
+        }
+
+    dyn_at_fail ( dyn, dyn.size ());
+    dyn_at_fail ( dyn, 2*dyn.size ());
+    dyn_at_fail ( dyn, size_t (-1));
+    }
+
+
+template <class T>
+void test ( std::initializer_list<T> vals ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( vals );
+    dyn_test ( d1, vals );
+    dyn_test_const ( d1, vals );
+    }
+
+int main()
+{
+    test ( { 1, 1, 2, 3, 5, 8 } );
+    test ( { 1., 1., 2., 3., 5., 8. } );
+    test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), 
+                std::string("5"), std::string("8")} );
+
+    test<int> ( {} );
+    test<std::complex<double>> ( {} );
+    test<std::string> ( {} );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,108 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.overview
+
+
+// iterator       begin()        noexcept;
+// const_iterator begin()  const noexcept;
+// const_iterator cbegin() const noexcept;
+// iterator       end()          noexcept;
+// const_iterator end()    const noexcept;
+// const_iterator cend()   const noexcept;
+// 
+// reverse_iterator       rbegin()        noexcept;
+// const_reverse_iterator rbegin()  const noexcept;
+// const_reverse_iterator crbegin() const noexcept;
+// reverse_iterator       rend()          noexcept;
+// const_reverse_iterator rend()    const noexcept;
+// const_reverse_iterator crend()   const noexcept;
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void dyn_test_const ( const dynarray<T> &dyn ) {
+    const T *data = dyn.data ();
+    assert ( data == &*dyn.begin ());
+    assert ( data == &*dyn.cbegin ());
+
+    assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
+    assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
+
+    assert ( dyn.size () == std::distance ( dyn.begin(), dyn.end()));
+    assert ( dyn.size () == std::distance ( dyn.cbegin(), dyn.cend()));
+    assert ( dyn.size () == std::distance ( dyn.rbegin(), dyn.rend()));
+    assert ( dyn.size () == std::distance ( dyn.crbegin(), dyn.crend()));
+
+    assert (   dyn.begin ()  ==   dyn.cbegin ());
+    assert ( &*dyn.begin ()  == &*dyn.cbegin ());
+    assert (   dyn.rbegin () ==   dyn.crbegin ());
+    assert ( &*dyn.rbegin () == &*dyn.crbegin ());
+    assert (   dyn.end ()    ==   dyn.cend ());
+    assert (   dyn.rend ()   ==   dyn.crend ());
+    }
+
+template <class T>
+void dyn_test ( dynarray<T> &dyn ) {
+    T *data = dyn.data ();
+    assert ( data == &*dyn.begin ());
+    assert ( data == &*dyn.cbegin ());
+
+    assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
+    assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
+
+    assert ( dyn.size () == std::distance ( dyn.begin(), dyn.end()));
+    assert ( dyn.size () == std::distance ( dyn.cbegin(), dyn.cend()));
+    assert ( dyn.size () == std::distance ( dyn.rbegin(), dyn.rend()));
+    assert ( dyn.size () == std::distance ( dyn.crbegin(), dyn.crend()));
+
+    assert (   dyn.begin ()  ==   dyn.cbegin ());
+    assert ( &*dyn.begin ()  == &*dyn.cbegin ());
+    assert (   dyn.rbegin () ==   dyn.crbegin ());
+    assert ( &*dyn.rbegin () == &*dyn.crbegin ());
+    assert (   dyn.end ()    ==   dyn.cend ());
+    assert (   dyn.rend ()   ==   dyn.crend ());
+    }
+
+
+template <class T>
+void test ( const T &val ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( 4 );
+    dyn_test ( d1 );
+    dyn_test_const ( d1 );
+    
+    dynA d2 ( 7, val );
+    dyn_test ( d2 );
+    dyn_test_const ( d2 );
+    }
+
+int main()
+{
+    test<int> ( 14 );
+    test<double> ( 14.0 );
+    test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
+    test<std::string> ( "fourteen" );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.overview
+
+// size_type size()     const noexcept;
+// size_type max_size() const noexcept;
+// bool      empty()    const noexcept;  
+
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void dyn_test ( const dynarray<T> &dyn, size_t sz ) {
+    assert ( dyn.size ()     == sz );
+    assert ( dyn.max_size () == sz );
+    assert ( dyn.empty () == ( sz == 0 ));
+    }
+
+template <class T>
+void test ( std::initializer_list<T> vals ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( vals );
+    dyn_test ( d1, vals.size ());
+    }
+
+int main()
+{
+    test ( { 1, 1, 2, 3, 5, 8 } );
+    test ( { 1., 1., 2., 3., 5., 8. } );
+    test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), 
+                std::string("5"), std::string("8")} );
+
+    test<int> ( {} );
+    test<std::complex<double>> ( {} );
+    test<std::string> ( {} );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.overview
+
+// reference       front();
+// const_reference front() const;
+// reference       back();
+// const_reference back()  const;
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void dyn_test_const ( const dynarray<T> &dyn ) {
+    const T *data = dyn.data ();
+    assert ( *data == dyn.front ());
+    assert ( *(data + dyn.size() - 1 ) == dyn.back ());
+    }
+
+template <class T>
+void dyn_test ( dynarray<T> &dyn ) {
+    T *data = dyn.data ();
+    assert ( *data == dyn.front ());
+    assert ( *(data + dyn.size() - 1 ) == dyn.back ());
+    }
+
+
+template <class T>
+void test ( const T &val ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( 4 );
+    dyn_test ( d1 );
+    dyn_test_const ( d1 );
+    
+    dynA d2 ( 7, val );
+    dyn_test ( d2 );
+    dyn_test_const ( d2 );
+    }
+
+int main()
+{
+    test<int> ( 14 );
+    test<double> ( 14.0 );
+    test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
+    test<std::string> ( "fourteen" );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.overview
+
+// const_reference at(size_type n) const;
+//       reference at(size_type n);
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+    const T *data = dyn.data ();
+    auto it = vals.begin ();
+    for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
+        assert ( data + i == &dyn[i]);
+        assert ( *it == dyn[i]);
+        }
+    }
+
+template <class T>
+void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+    T *data = dyn.data ();
+    auto it = vals.begin ();
+    for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
+        assert ( data + i == &dyn[i]);
+        assert ( *it == dyn[i]);
+        }
+    }
+
+
+template <class T>
+void test ( std::initializer_list<T> vals ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( vals );
+    dyn_test ( d1, vals );
+    dyn_test_const ( d1, vals );
+    }
+
+int main()
+{
+    test ( { 1, 1, 2, 3, 5, 8 } );
+    test ( { 1., 1., 2., 3., 5., 8. } );
+    test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), 
+                std::string("5"), std::string("8")} );
+
+    test<int> ( {} );
+    test<std::complex<double>> ( {} );
+    test<std::string> ( {} );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.traits/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.traits/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.traits/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.data
+
+// template <class Type, class Alloc>
+//   struct uses_allocator<dynarray<Type>, Alloc> : true_type { };
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include "test_allocator.h"
+
+using std::experimental::dynarray;
+
+int main()
+{
+    static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" );
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.zero/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.zero/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/dynarray.zero/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// dynarray.zero
+
+// dynarray shall provide support for the special case of construction with a size of zero.
+// In the case that the size is zero, begin() == end() == unique value. 
+// The return value of data() is unspecified. 
+// The effect of calling front() or back() for a zero-sized dynarray is undefined.
+
+
+  
+#include <__config>
+
+#if _LIBCPP_STD_VER > 11
+
+#include <experimental/dynarray>
+#include <cassert>
+
+#include <algorithm>
+#include <complex>
+#include <string>
+
+using std::experimental::dynarray;
+
+template <class T>
+void test ( ) {
+    typedef dynarray<T> dynA;
+    
+    dynA d1 ( 0 );
+    assert ( d1.size() == 0 );
+    assert ( d1.begin() == d1.end ());
+    }
+
+int main()
+{
+    test<int> ();
+    test<double> ();
+    test<std::complex<double>> ();
+    test<std::string> ();
+}
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/containers/sequences/dynarray/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/dynarray/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/dynarray/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/dynarray/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.access/front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// reference       front();
+// const_reference front() const;
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        assert(c.front() == 0);
+        c.front() = 10;
+        assert(c.front() == 10);
+        assert(*c.begin() == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const C c(std::begin(t), std::end(t));
+        assert(c.front() == 0);
+        assert(*c.begin() == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        assert(c.front() == 0);
+        c.front() = 10;
+        assert(c.front() == 10);
+        assert(*c.begin() == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const C c(std::begin(t), std::end(t));
+        assert(c.front() == 0);
+        assert(*c.begin() == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.fail.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// explicit forward_list(const allocator_type& a);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "../../../NotConstructible.h"
+
+int main()
+{
+    {
+        typedef test_allocator<NotConstructible> A;
+        typedef A::value_type T;
+        typedef std::forward_list<T, A> C;
+        C c = A(12);
+        assert(c.get_allocator() == A(12));
+        assert(c.empty());
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// explicit forward_list(const allocator_type& a);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "../../../NotConstructible.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef test_allocator<NotConstructible> A;
+        typedef A::value_type T;
+        typedef std::forward_list<T, A> C;
+        C c(A(12));
+        assert(c.get_allocator() == A(12));
+        assert(c.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef min_allocator<NotConstructible> A;
+        typedef A::value_type T;
+        typedef std::forward_list<T, A> C;
+        C c(A{});
+        assert(c.get_allocator() == A());
+        assert(c.empty());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,146 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list& operator=(const forward_list& x);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const T t1[] = {10, 11, 12, 13};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(10));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(10));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const T t1[] = {10, 11, 12, 13};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(11));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(11));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {10, 11, 12, 13};
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(10));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(10));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {10, 11, 12, 13};
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(11));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(11));
+    }
+
+    {
+        typedef int T;
+        typedef other_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const T t1[] = {10, 11, 12, 13};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(10));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(10));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const T t1[] = {10, 11, 12, 13};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(11));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(10));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {10, 11, 12, 13};
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(10));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(10));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {10, 11, 12, 13};
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t0), std::end(t0), A(10));
+        C c1(std::begin(t1), std::end(t1), A(11));
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A(10));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef min_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const T t1[] = {10, 11, 12, 13};
+        C c0(std::begin(t0), std::end(t0), A());
+        C c1(std::begin(t1), std::end(t1), A());
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A());
+    }
+    {
+        typedef int T;
+        typedef min_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t0[] = {10, 11, 12, 13};
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t0), std::end(t0), A());
+        C c1(std::begin(t1), std::end(t1), A());
+        c1 = c0;
+        assert(c1 == c0);
+        assert(c1.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void assign(initializer_list<value_type> il);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        c.assign({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        c.assign({10, 11, 12, 13});
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        c.assign({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        c.assign({10, 11, 12, 13});
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,199 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list& operator=(forward_list&& x);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_allocator.h"
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        T t1[] = {10, 11, 12, 13};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+        assert(c1.get_allocator() == A(10));
+        assert(c0.empty());
+    }
+    {
+        typedef MoveOnly T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        T t1[] = {10, 11, 12, 13};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+        assert(c1.get_allocator() == A(11));
+        assert(!c0.empty());
+    }
+    {
+        typedef MoveOnly T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {10, 11, 12, 13};
+        T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+        assert(c1.get_allocator() == A(10));
+        assert(c0.empty());
+    }
+    {
+        typedef MoveOnly T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {10, 11, 12, 13};
+        T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+        assert(c1.get_allocator() == A(11));
+        assert(!c0.empty());
+    }
+
+    {
+        typedef MoveOnly T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        T t1[] = {10, 11, 12, 13};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+        assert(c1.get_allocator() == A(10));
+        assert(c0.empty());
+    }
+    {
+        typedef MoveOnly T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        T t1[] = {10, 11, 12, 13};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+        assert(c1.get_allocator() == A(10));
+        assert(c0.empty());
+    }
+    {
+        typedef MoveOnly T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {10, 11, 12, 13};
+        T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(10));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+        assert(c1.get_allocator() == A(10));
+        assert(c0.empty());
+    }
+    {
+        typedef MoveOnly T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {10, 11, 12, 13};
+        T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A(10));
+        C c1(I(std::begin(t1)), I(std::end(t1)), A(11));
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+        assert(c1.get_allocator() == A(10));
+        assert(c0.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef MoveOnly T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        T t1[] = {10, 11, 12, 13};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A());
+        C c1(I(std::begin(t1)), I(std::end(t1)), A());
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+        assert(c1.get_allocator() == A());
+        assert(c0.empty());
+    }
+    {
+        typedef MoveOnly T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        T t0[] = {10, 11, 12, 13};
+        T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t0)), I(std::end(t0)), A());
+        C c1(I(std::begin(t1)), I(std::end(t1)), A());
+        c1 = std::move(c0);
+        int n = 0;
+        for (C::const_iterator i = c1.cbegin(); i != c1.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+        assert(c1.get_allocator() == A());
+        assert(c0.empty());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list& operator=(initializer_list<value_type> il);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        c = {10, 11, 12, 13};
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        c = {10, 11, 12, 13};
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class InputIterator>
+//     void assign(InputIterator first, InputIterator last);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        typedef input_iterator<const T*> I;
+        c.assign(I(std::begin(t0)), I(std::end(t0)));
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t0[] = {10, 11, 12, 13};
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        typedef input_iterator<const T*> I;
+        c.assign(I(std::begin(t0)), I(std::end(t0)));
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        typedef input_iterator<const T*> I;
+        c.assign(I(std::begin(t0)), I(std::end(t0)));
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t0[] = {10, 11, 12, 13};
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        typedef input_iterator<const T*> I;
+        c.assign(I(std::begin(t0)), I(std::end(t0)));
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, (void) ++n)
+            assert(*i == 10+n);
+        assert(n == 4);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void assign(size_type n, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        c.assign(10, 1);
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 1);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        c.assign(4, 10);
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 10);
+        assert(n == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {10, 11, 12, 13};
+        C c(std::begin(t1), std::end(t1));
+        c.assign(10, 1);
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 1);
+        assert(n == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t1), std::end(t1));
+        c.assign(4, 10);
+        int n = 0;
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+            assert(*i == 10);
+        assert(n == 4);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(const forward_list& x);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t), std::end(t), A(10));
+        C c = c0;
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c == c0);
+        assert(c.get_allocator() == A(10));
+    }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        typedef int T;
+        typedef other_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t), std::end(t), A(10));
+        C c = c0;
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c == c0);
+        assert(c.get_allocator() == A(-2));
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef min_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t), std::end(t), A());
+        C c = c0;
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c == c0);
+        assert(c.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(const forward_list& x, const allocator_type& a);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t), std::end(t), A(10));
+        C c(c0, A(9));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c == c0);
+        assert(c.get_allocator() == A(9));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t), std::end(t), A(10));
+        C c(c0, A(9));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c == c0);
+        assert(c.get_allocator() == A(9));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef min_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c0(std::begin(t), std::end(t), A());
+        C c(c0, A());
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c == c0);
+        assert(c.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list();
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c;
+        assert(c.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        assert(c.empty());
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c = {};
+        assert(c.empty());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list()
+//        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::forward_list<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// class forward_list
+
+// forward_list();
+
+#include <forward_list>
+
+struct X
+{
+    std::forward_list<X> q;
+};
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// ~forward_list() // implied noexcept;
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+#if __has_feature(cxx_noexcept)
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+    ~some_alloc() noexcept(false);
+};
+
+#endif
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::forward_list<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(initializer_list<value_type> il);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(initializer_list<value_type> il, const allocator_type& a);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A(14));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+        assert(c.get_allocator() == A(14));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A());
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == 10);
+        assert(c.get_allocator() == A());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(forward_list&& x);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_allocator.h"
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t)), I(std::end(t)), A(10));
+        C c = std::move(c0);
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c0.empty());
+        assert(c.get_allocator() == A(10));
+    }
+    {
+        typedef MoveOnly T;
+        typedef other_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t)), I(std::end(t)), A(10));
+        C c = std::move(c0);
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c0.empty());
+        assert(c.get_allocator() == A(10));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef MoveOnly T;
+        typedef min_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t)), I(std::end(t)), A());
+        C c = std::move(c0);
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c0.empty());
+        assert(c.get_allocator() == A());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(forward_list&& x, const allocator_type& a);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_allocator.h"
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t)), I(std::end(t)), A(10));
+        C c(std::move(c0), A(10));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c0.empty());
+        assert(c.get_allocator() == A(10));
+    }
+    {
+        typedef MoveOnly T;
+        typedef test_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t)), I(std::end(t)), A(10));
+        C c(std::move(c0), A(9));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(!c0.empty());
+        assert(c.get_allocator() == A(9));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef MoveOnly T;
+        typedef min_allocator<int> A;
+        typedef std::forward_list<T, A> C;
+        T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        typedef std::move_iterator<T*> I;
+        C c0(I(std::begin(t)), I(std::end(t)), A());
+        C c(std::move(c0), A());
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c0.empty());
+        assert(c.get_allocator() == A());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list& operator=(forward_list&& c)
+//     noexcept(
+//          allocator_type::propagate_on_container_move_assignment::value &&
+//          is_nothrow_move_assignable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::forward_list<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(forward_list&&)
+//        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::forward_list<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class InputIterator>
+//     forward_list(InputIterator first, InputIterator last);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        typedef input_iterator<const T*> I;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(I(std::begin(t)), I(std::end(t)));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef input_iterator<const T*> I;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(I(std::begin(t)), I(std::end(t)));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class InputIterator>
+//     forward_list(InputIterator first, InputIterator last,
+//                  const allocator_type& a);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "test_allocator.h"
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        typedef input_iterator<const T*> I;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(I(std::begin(t)), I(std::end(t)), A(13));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c.get_allocator() == A(13));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        typedef input_iterator<const T*> I;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(I(std::begin(t)), I(std::end(t)), A());
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == n);
+        assert(n == std::end(t) - std::begin(t));
+        assert(c.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// explicit forward_list(size_type n);
+
+#include <forward_list>
+#include <cassert>
+
+#include "DefaultOnly.h"
+
+int main()
+{
+    {
+        typedef DefaultOnly T;
+        typedef std::forward_list<T> C;
+        unsigned N = 10;
+        C c = N;
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+            assert(*i == T());
+#else
+            ;
+#endif
+        assert(n == N);
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// explicit forward_list(size_type n);
+// explicit forward_list(size_type n, const Alloc& a);
+
+#include <forward_list>
+#include <cassert>
+
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void check_allocator(unsigned n, Allocator const &alloc = Allocator())
+{
+#if _LIBCPP_STD_VER > 11
+    typedef std::forward_list<T, Allocator> C;
+    C d(n, alloc);
+    assert(d.get_allocator() == alloc);
+    assert(std::distance(d.begin(), d.end()) == n);
+#endif
+}
+
+int main()
+{
+    {
+        typedef DefaultOnly T;
+        typedef std::forward_list<T> C;
+        unsigned N = 10;
+        C c(N);
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+            assert(*i == T());
+#else
+            ;
+#endif
+        assert(n == N);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef DefaultOnly T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        unsigned N = 10;
+        C c(N);
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+            assert(*i == T());
+#else
+            ;
+#endif
+        assert(n == N);
+        check_allocator<T, min_allocator<T>> ( 0 );
+        check_allocator<T, min_allocator<T>> ( 3 );
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(size_type n, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        T v(6);
+        unsigned N = 10;
+        C c(N, v);
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == v);
+        assert(n == N);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        T v(6);
+        unsigned N = 10;
+        C c(N, v);
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == v);
+        assert(n == N);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/size_value_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// forward_list(size_type n, const value_type& v, const allocator_type& a);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef test_allocator<int> A;
+        typedef A::value_type T;
+        typedef std::forward_list<T, A> C;
+        T v(6);
+        unsigned N = 10;
+        C c(N, v, A(12));
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == v);
+        assert(n == N);
+        assert(c.get_allocator() == A(12));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef min_allocator<int> A;
+        typedef A::value_type T;
+        typedef std::forward_list<T, A> C;
+        T v(6);
+        unsigned N = 10;
+        C c(N, v, A());
+        unsigned n = 0;
+        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
+            assert(*i == v);
+        assert(n == N);
+        assert(c.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/before_begin.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator       before_begin();
+// const_iterator before_begin() const;
+// const_iterator cbefore_begin() const;
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c;
+        C::iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 1);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const C c;
+        C::const_iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 1);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const C c;
+        C::const_iterator i = c.cbefore_begin();
+        assert(std::distance(i, c.end()) == 1);
+        assert(c.cbefore_begin() == c.before_begin());
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        C::iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 11);
+        assert(std::next(c.before_begin()) == c.begin());
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const C c(std::begin(t), std::end(t));
+        C::const_iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 11);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        C::iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 1);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const C c;
+        C::const_iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 1);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const C c;
+        C::const_iterator i = c.cbefore_begin();
+        assert(std::distance(i, c.end()) == 1);
+        assert(c.cbefore_begin() == c.before_begin());
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        C::iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 11);
+        assert(std::next(c.before_begin()) == c.begin());
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        const C c(std::begin(t), std::end(t));
+        C::const_iterator i = c.before_begin();
+        assert(std::distance(i, c.end()) == 11);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,145 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator       begin();
+// iterator       end();
+// const_iterator begin()  const;
+// const_iterator end()    const;
+// const_iterator cbegin() const;
+// const_iterator cend()   const;
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c;
+        C::iterator i = c.begin();
+        C::iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const C c;
+        C::const_iterator i = c.begin();
+        C::const_iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c;
+        C::const_iterator i = c.cbegin();
+        C::const_iterator j = c.cend();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+        assert(i == c.end());
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        C::iterator i = c.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 1);
+        *i = 10;
+        assert(*i == 10);
+        assert(std::distance(c.begin(), c.end()) == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C::iterator i;
+        C::const_iterator j;
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        C::iterator i = c.begin();
+        C::iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const C c;
+        C::const_iterator i = c.begin();
+        C::const_iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        C::const_iterator i = c.cbegin();
+        C::const_iterator j = c.cend();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+        assert(i == c.end());
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        C::iterator i = c.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 1);
+        *i = 10;
+        assert(*i == 10);
+        assert(std::distance(c.begin(), c.end()) == 10);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C::iterator i;
+        C::const_iterator j;
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    { // N3644 testing
+        std::forward_list<int>::iterator ii1{}, ii2{};
+        std::forward_list<int>::iterator ii4 = ii1;
+        std::forward_list<int>::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+ 
+        assert (!(ii1 != ii2 ));
+
+        assert ( (ii1 == cii ));
+        assert ( (cii == ii1 ));
+        assert (!(ii1 != cii ));
+        assert (!(cii != ii1 ));
+
+//         std::forward_list<int> c;
+//         assert ( ii1 != c.cbegin());
+//         assert ( cii != c.begin());
+//         assert ( cii != c.cend());
+//         assert ( ii1 != c.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void clear();
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef NotConstructible T;
+        typedef std::forward_list<T> C;
+        C c;
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef NotConstructible T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class... Args>
+//     iterator emplace_after(const_iterator p, Args&&... args);
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef Emplaceable T;
+        typedef std::forward_list<T> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.emplace_after(c.cbefore_begin());
+        assert(i == c.begin());
+        assert(c.front() == Emplaceable());
+        assert(distance(c.begin(), c.end()) == 1);
+
+        i = c.emplace_after(c.cbegin(), 1, 2.5);
+        assert(i == next(c.begin()));
+        assert(c.front() == Emplaceable());
+        assert(*next(c.begin()) == Emplaceable(1, 2.5));
+        assert(distance(c.begin(), c.end()) == 2);
+
+        i = c.emplace_after(next(c.cbegin()), 2, 3.5);
+        assert(i == next(c.begin(), 2));
+        assert(c.front() == Emplaceable());
+        assert(*next(c.begin()) == Emplaceable(1, 2.5));
+        assert(*next(c.begin(), 2) == Emplaceable(2, 3.5));
+        assert(distance(c.begin(), c.end()) == 3);
+
+        i = c.emplace_after(c.cbegin(), 3, 4.5);
+        assert(i == next(c.begin()));
+        assert(c.front() == Emplaceable());
+        assert(*next(c.begin(), 1) == Emplaceable(3, 4.5));
+        assert(*next(c.begin(), 2) == Emplaceable(1, 2.5));
+        assert(*next(c.begin(), 3) == Emplaceable(2, 3.5));
+        assert(distance(c.begin(), c.end()) == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef Emplaceable T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.emplace_after(c.cbefore_begin());
+        assert(i == c.begin());
+        assert(c.front() == Emplaceable());
+        assert(distance(c.begin(), c.end()) == 1);
+
+        i = c.emplace_after(c.cbegin(), 1, 2.5);
+        assert(i == next(c.begin()));
+        assert(c.front() == Emplaceable());
+        assert(*next(c.begin()) == Emplaceable(1, 2.5));
+        assert(distance(c.begin(), c.end()) == 2);
+
+        i = c.emplace_after(next(c.cbegin()), 2, 3.5);
+        assert(i == next(c.begin(), 2));
+        assert(c.front() == Emplaceable());
+        assert(*next(c.begin()) == Emplaceable(1, 2.5));
+        assert(*next(c.begin(), 2) == Emplaceable(2, 3.5));
+        assert(distance(c.begin(), c.end()) == 3);
+
+        i = c.emplace_after(c.cbegin(), 3, 4.5);
+        assert(i == next(c.begin()));
+        assert(c.front() == Emplaceable());
+        assert(*next(c.begin(), 1) == Emplaceable(3, 4.5));
+        assert(*next(c.begin(), 2) == Emplaceable(1, 2.5));
+        assert(*next(c.begin(), 3) == Emplaceable(2, 3.5));
+        assert(distance(c.begin(), c.end()) == 4);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class... Args> void emplace_front(Args&&... args);
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef Emplaceable T;
+        typedef std::forward_list<T> C;
+        C c;
+        c.emplace_front();
+        assert(c.front() == Emplaceable());
+        assert(distance(c.begin(), c.end()) == 1);
+        c.emplace_front(1, 2.5);
+        assert(c.front() == Emplaceable(1, 2.5));
+        assert(*next(c.begin()) == Emplaceable());
+        assert(distance(c.begin(), c.end()) == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef Emplaceable T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        c.emplace_front();
+        assert(c.front() == Emplaceable());
+        assert(distance(c.begin(), c.end()) == 1);
+        c.emplace_front(1, 2.5);
+        assert(c.front() == Emplaceable(1, 2.5));
+        assert(*next(c.begin()) == Emplaceable());
+        assert(distance(c.begin(), c.end()) == 2);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator erase_after(const_iterator first, const_iterator last);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+
+        C::iterator i = c.erase_after(next(c.cbefore_begin(), 4), next(c.cbefore_begin(), 4));
+        assert(i == next(c.cbefore_begin(), 4));
+        assert(distance(c.begin(), c.end()) == 10);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 3);
+        assert(*next(c.begin(), 4) == 4);
+        assert(*next(c.begin(), 5) == 5);
+        assert(*next(c.begin(), 6) == 6);
+        assert(*next(c.begin(), 7) == 7);
+        assert(*next(c.begin(), 8) == 8);
+        assert(*next(c.begin(), 9) == 9);
+
+        i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 5));
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 8);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 5);
+        assert(*next(c.begin(), 4) == 6);
+        assert(*next(c.begin(), 5) == 7);
+        assert(*next(c.begin(), 6) == 8);
+        assert(*next(c.begin(), 7) == 9);
+
+        i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 3));
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 8);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 5);
+        assert(*next(c.begin(), 4) == 6);
+        assert(*next(c.begin(), 5) == 7);
+        assert(*next(c.begin(), 6) == 8);
+        assert(*next(c.begin(), 7) == 9);
+
+        i = c.erase_after(next(c.cbefore_begin(), 5), next(c.cbefore_begin(), 9));
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 5);
+        assert(*next(c.begin(), 4) == 6);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 2));
+        assert(i == c.begin());
+        assert(distance(c.begin(), c.end()) == 4);
+        assert(*next(c.begin(), 0) == 1);
+        assert(*next(c.begin(), 1) == 4);
+        assert(*next(c.begin(), 2) == 5);
+        assert(*next(c.begin(), 3) == 6);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 5));
+        assert(i == c.begin());
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+
+        C::iterator i = c.erase_after(next(c.cbefore_begin(), 4), next(c.cbefore_begin(), 4));
+        assert(i == next(c.cbefore_begin(), 4));
+        assert(distance(c.begin(), c.end()) == 10);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 3);
+        assert(*next(c.begin(), 4) == 4);
+        assert(*next(c.begin(), 5) == 5);
+        assert(*next(c.begin(), 6) == 6);
+        assert(*next(c.begin(), 7) == 7);
+        assert(*next(c.begin(), 8) == 8);
+        assert(*next(c.begin(), 9) == 9);
+
+        i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 5));
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 8);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 5);
+        assert(*next(c.begin(), 4) == 6);
+        assert(*next(c.begin(), 5) == 7);
+        assert(*next(c.begin(), 6) == 8);
+        assert(*next(c.begin(), 7) == 9);
+
+        i = c.erase_after(next(c.cbefore_begin(), 2), next(c.cbefore_begin(), 3));
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 8);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 5);
+        assert(*next(c.begin(), 4) == 6);
+        assert(*next(c.begin(), 5) == 7);
+        assert(*next(c.begin(), 6) == 8);
+        assert(*next(c.begin(), 7) == 9);
+
+        i = c.erase_after(next(c.cbefore_begin(), 5), next(c.cbefore_begin(), 9));
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 5);
+        assert(*next(c.begin(), 4) == 6);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 2));
+        assert(i == c.begin());
+        assert(distance(c.begin(), c.end()) == 4);
+        assert(*next(c.begin(), 0) == 1);
+        assert(*next(c.begin(), 1) == 4);
+        assert(*next(c.begin(), 2) == 5);
+        assert(*next(c.begin(), 3) == 6);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0), next(c.cbefore_begin(), 5));
+        assert(i == c.begin());
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/erase_after_one.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator erase_after(const_iterator p);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        C::iterator i = c.erase_after(next(c.cbefore_begin(), 4));
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 4);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 3);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0));
+        assert(i == c.begin());
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 1);
+        assert(*next(c.begin(), 1) == 2);
+        assert(*next(c.begin(), 2) == 3);
+
+        i = c.erase_after(next(c.cbefore_begin(), 1));
+        assert(i == next(c.begin()));
+        assert(distance(c.begin(), c.end()) == 2);
+        assert(*next(c.begin(), 0) == 1);
+        assert(*next(c.begin(), 1) == 3);
+
+        i = c.erase_after(next(c.cbefore_begin(), 1));
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 1);
+        assert(*next(c.begin(), 0) == 1);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0));
+        assert(i == c.begin());
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        C::iterator i = c.erase_after(next(c.cbefore_begin(), 4));
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 4);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 3);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0));
+        assert(i == c.begin());
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 1);
+        assert(*next(c.begin(), 1) == 2);
+        assert(*next(c.begin(), 2) == 3);
+
+        i = c.erase_after(next(c.cbefore_begin(), 1));
+        assert(i == next(c.begin()));
+        assert(distance(c.begin(), c.end()) == 2);
+        assert(*next(c.begin(), 0) == 1);
+        assert(*next(c.begin(), 1) == 3);
+
+        i = c.erase_after(next(c.cbefore_begin(), 1));
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 1);
+        assert(*next(c.begin(), 0) == 1);
+
+        i = c.erase_after(next(c.cbefore_begin(), 0));
+        assert(i == c.begin());
+        assert(i == c.end());
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), 0);
+        assert(i == c.begin());
+        assert(c.front() == 0);
+        assert(c.front() == 0);
+        assert(distance(c.begin(), c.end()) == 1);
+
+        i = c.insert_after(c.cbegin(), 1);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+
+        i = c.insert_after(next(c.cbegin()), 2);
+        assert(i == next(c.begin(), 2));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(distance(c.begin(), c.end()) == 3);
+
+        i = c.insert_after(c.cbegin(), 3);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 1);
+        assert(*next(c.begin(), 3) == 2);
+        assert(distance(c.begin(), c.end()) == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), 0);
+        assert(i == c.begin());
+        assert(c.front() == 0);
+        assert(c.front() == 0);
+        assert(distance(c.begin(), c.end()) == 1);
+
+        i = c.insert_after(c.cbegin(), 1);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+
+        i = c.insert_after(next(c.cbegin()), 2);
+        assert(i == next(c.begin(), 2));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(distance(c.begin(), c.end()) == 3);
+
+        i = c.insert_after(c.cbegin(), 3);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 1);
+        assert(*next(c.begin(), 3) == 2);
+        assert(distance(c.begin(), c.end()) == 4);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, initializer_list<value_type> il);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), {});
+        assert(i == c.before_begin());
+        assert(distance(c.begin(), c.end()) == 0);
+
+        i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
+        assert(i == next(c.before_begin(), 3));
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        i = c.insert_after(c.begin(), {3, 4});
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 1);
+        assert(*next(c.begin(), 4) == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), {});
+        assert(i == c.before_begin());
+        assert(distance(c.begin(), c.end()) == 0);
+
+        i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
+        assert(i == next(c.before_begin(), 3));
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        i = c.insert_after(c.begin(), {3, 4});
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 1);
+        assert(*next(c.begin(), 4) == 2);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class InputIterator>
+//     iterator insert_after(const_iterator p,
+//                           InputIterator first, InputIterator last);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        typedef C::iterator I;
+        typedef input_iterator<const T*> J;
+        C c;
+        const T t[] = {0, 1, 2, 3, 4};
+        I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
+        assert(i == c.before_begin());
+        assert(distance(c.begin(), c.end()) == 0);
+
+        i = c.insert_after(c.cbefore_begin(), J(t), J(t+3));
+        assert(i == next(c.before_begin(), 3));
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        i = c.insert_after(c.begin(), J(t+3), J(t+5));
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 1);
+        assert(*next(c.begin(), 4) == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef C::iterator I;
+        typedef input_iterator<const T*> J;
+        C c;
+        const T t[] = {0, 1, 2, 3, 4};
+        I i = c.insert_after(c.cbefore_begin(), J(t), J(t));
+        assert(i == c.before_begin());
+        assert(distance(c.begin(), c.end()) == 0);
+
+        i = c.insert_after(c.cbefore_begin(), J(t), J(t+3));
+        assert(i == next(c.before_begin(), 3));
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        i = c.insert_after(c.begin(), J(t+3), J(t+5));
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 4);
+        assert(*next(c.begin(), 3) == 1);
+        assert(*next(c.begin(), 4) == 2);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, value_type&& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly T;
+        typedef std::forward_list<T> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), 0);
+        assert(i == c.begin());
+        assert(c.front() == 0);
+        assert(c.front() == 0);
+        assert(distance(c.begin(), c.end()) == 1);
+
+        i = c.insert_after(c.cbegin(), 1);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+
+        i = c.insert_after(next(c.cbegin()), 2);
+        assert(i == next(c.begin(), 2));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(distance(c.begin(), c.end()) == 3);
+
+        i = c.insert_after(c.cbegin(), 3);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 1);
+        assert(*next(c.begin(), 3) == 2);
+        assert(distance(c.begin(), c.end()) == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef MoveOnly T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), 0);
+        assert(i == c.begin());
+        assert(c.front() == 0);
+        assert(c.front() == 0);
+        assert(distance(c.begin(), c.end()) == 1);
+
+        i = c.insert_after(c.cbegin(), 1);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+
+        i = c.insert_after(next(c.cbegin()), 2);
+        assert(i == next(c.begin(), 2));
+        assert(c.front() == 0);
+        assert(*next(c.begin()) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(distance(c.begin(), c.end()) == 3);
+
+        i = c.insert_after(c.cbegin(), 3);
+        assert(i == next(c.begin()));
+        assert(c.front() == 0);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 1);
+        assert(*next(c.begin(), 3) == 2);
+        assert(distance(c.begin(), c.end()) == 4);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// iterator insert_after(const_iterator p, size_type n, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), 0, 0);
+        assert(i == c.before_begin());
+        assert(distance(c.begin(), c.end()) == 0);
+
+        i = c.insert_after(c.cbefore_begin(), 3, 3);
+        assert(i == next(c.before_begin(), 3));
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 3);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 3);
+
+        i = c.insert_after(c.begin(), 2, 2);
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 3);
+        assert(*next(c.begin(), 1) == 2);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 3);
+        assert(*next(c.begin(), 4) == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef C::iterator I;
+        C c;
+        I i = c.insert_after(c.cbefore_begin(), 0, 0);
+        assert(i == c.before_begin());
+        assert(distance(c.begin(), c.end()) == 0);
+
+        i = c.insert_after(c.cbefore_begin(), 3, 3);
+        assert(i == next(c.before_begin(), 3));
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 3);
+        assert(*next(c.begin(), 1) == 3);
+        assert(*next(c.begin(), 2) == 3);
+
+        i = c.insert_after(c.begin(), 2, 2);
+        assert(i == next(c.begin(), 2));
+        assert(distance(c.begin(), c.end()) == 5);
+        assert(*next(c.begin(), 0) == 3);
+        assert(*next(c.begin(), 1) == 2);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 3);
+        assert(*next(c.begin(), 4) == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void pop_front();
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        typedef std::forward_list<T> C;
+        C c;
+        c.push_front(1);
+        c.push_front(3);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 1);
+        assert(c.front() == 1);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly T;
+        typedef std::forward_list<T> C;
+        C c;
+        c.push_front(1);
+        c.push_front(3);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 1);
+        assert(c.front() == 1);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        c.push_front(1);
+        c.push_front(3);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 1);
+        assert(c.front() == 1);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        c.push_front(1);
+        c.push_front(3);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 1);
+        assert(c.front() == 1);
+        c.pop_front();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_const.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void push_front(const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c;
+        c.push_front(1);
+        assert(c.front() == 1);
+        assert(distance(c.begin(), c.end()) == 1);
+        c.push_front(3);
+        assert(c.front() == 3);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        c.push_front(1);
+        assert(c.front() == 1);
+        assert(distance(c.begin(), c.end()) == 1);
+        c.push_front(3);
+        assert(c.front() == 3);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void push_front(const value_type& x);
+
+#include <forward_list>
+#include <cassert>
+
+// Flag that makes the copy constructor for CMyClass throw an exception
+static bool gCopyConstructorShouldThow = false;
+
+
+class CMyClass {
+    public: CMyClass();
+    public: CMyClass(const CMyClass& iOther);
+    public: ~CMyClass();
+
+    private: int fMagicValue;
+
+    private: static int kStartedConstructionMagicValue;
+    private: static int kFinishedConstructionMagicValue;
+};
+
+// Value for fMagicValue when the constructor has started running, but not yet finished
+int CMyClass::kStartedConstructionMagicValue = 0;
+// Value for fMagicValue when the constructor has finished running
+int CMyClass::kFinishedConstructionMagicValue = 12345;
+
+CMyClass::CMyClass() :
+    fMagicValue(kStartedConstructionMagicValue)
+{
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::CMyClass(const CMyClass& /*iOther*/) :
+    fMagicValue(kStartedConstructionMagicValue)
+{
+    // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+    if (gCopyConstructorShouldThow) {
+        throw std::exception();
+    }
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::~CMyClass() {
+    // Only instances for which the constructor has finished running should be destructed
+    assert(fMagicValue == kFinishedConstructionMagicValue);
+}
+
+int main()
+{
+    CMyClass instance;
+    std::forward_list<CMyClass> vec;
+
+    vec.push_front(instance);
+
+    gCopyConstructorShouldThow = true;
+    try {
+        vec.push_front(instance);
+    }
+    catch (...) {
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void push_front(value_type&& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef MoveOnly T;
+        typedef std::forward_list<T> C;
+        C c;
+        c.push_front(1);
+        assert(c.front() == 1);
+        assert(distance(c.begin(), c.end()) == 1);
+        c.push_front(3);
+        assert(c.front() == 3);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef MoveOnly T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        c.push_front(1);
+        assert(c.front() == 1);
+        assert(distance(c.begin(), c.end()) == 1);
+        c.push_front(3);
+        assert(c.front() == 3);
+        assert(*next(c.begin()) == 1);
+        assert(distance(c.begin(), c.end()) == 2);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void resize(size_type n);
+
+#include <forward_list>
+#include <cassert>
+
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef DefaultOnly T;
+        typedef std::forward_list<T> C;
+        C c;
+        c.resize(0);
+        assert(distance(c.begin(), c.end()) == 0);
+        c.resize(10);
+        assert(distance(c.begin(), c.end()) == 10);
+        c.resize(20);
+        assert(distance(c.begin(), c.end()) == 20);
+        c.resize(5);
+        assert(distance(c.begin(), c.end()) == 5);
+        c.resize(0);
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        c.resize(3);
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        c.resize(6);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 0);
+        assert(*next(c.begin(), 4) == 0);
+        assert(*next(c.begin(), 5) == 0);
+
+        c.resize(6);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 0);
+        assert(*next(c.begin(), 4) == 0);
+        assert(*next(c.begin(), 5) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef DefaultOnly T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        c.resize(0);
+        assert(distance(c.begin(), c.end()) == 0);
+        c.resize(10);
+        assert(distance(c.begin(), c.end()) == 10);
+        c.resize(20);
+        assert(distance(c.begin(), c.end()) == 20);
+        c.resize(5);
+        assert(distance(c.begin(), c.end()) == 5);
+        c.resize(0);
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        c.resize(3);
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        c.resize(6);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 0);
+        assert(*next(c.begin(), 4) == 0);
+        assert(*next(c.begin(), 5) == 0);
+
+        c.resize(6);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 0);
+        assert(*next(c.begin(), 4) == 0);
+        assert(*next(c.begin(), 5) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void resize(size_type n, const value_type& v);
+
+#include <forward_list>
+#include <cassert>
+
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        c.resize(3, 10);
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        c.resize(6, 10);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 10);
+        assert(*next(c.begin(), 4) == 10);
+        assert(*next(c.begin(), 5) == 10);
+
+        c.resize(6, 12);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 10);
+        assert(*next(c.begin(), 4) == 10);
+        assert(*next(c.begin(), 5) == 10);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        c.resize(3, 10);
+        assert(distance(c.begin(), c.end()) == 3);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+
+        c.resize(6, 10);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 10);
+        assert(*next(c.begin(), 4) == 10);
+        assert(*next(c.begin(), 5) == 10);
+
+        c.resize(6, 12);
+        assert(distance(c.begin(), c.end()) == 6);
+        assert(*next(c.begin(), 0) == 0);
+        assert(*next(c.begin(), 1) == 1);
+        assert(*next(c.begin(), 2) == 2);
+        assert(*next(c.begin(), 3) == 10);
+        assert(*next(c.begin(), 4) == 10);
+        assert(*next(c.begin(), 5) == 10);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void merge(forward_list&& x);
+
+#include <forward_list>
+#include <iterator>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {3, 5, 6, 7, 12, 13};
+        const T t2[] = {0, 1, 2, 4, 8, 9, 10, 11, 14, 15};
+        const T t3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.merge(c2);
+        C c3(std::begin(t3), std::end(t3));
+        assert(c1 == c3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {3, 5, 6, 7, 12, 13};
+        const T t2[] = {0, 1, 2, 4, 8, 9, 10, 11, 14, 15};
+        const T t3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.merge(c2);
+        C c3(std::begin(t3), std::end(t3));
+        assert(c1 == c3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/merge_pred.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class Compare> void merge(forward_list&& x, Compare comp);
+
+#include <forward_list>
+#include <iterator>
+#include <functional>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {13, 12, 7, 6, 5, 3};
+        const T t2[] = {15, 14, 11, 10, 9, 8, 4, 2, 1, 0};
+        const T t3[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.merge(c2, std::greater<T>());
+        C c3(std::begin(t3), std::end(t3));
+        assert(c1 == c3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {13, 12, 7, 6, 5, 3};
+        const T t2[] = {15, 14, 11, 10, 9, 8, 4, 2, 1, 0};
+        const T t3[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.merge(c2, std::greater<T>());
+        C c3(std::begin(t3), std::end(t3));
+        assert(c1 == c3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void remove(const value_type& v);
+
+#include <forward_list>
+#include <iterator>
+#include <cassert>
+
+#include "min_allocator.h"
+
+struct S {
+    S(int i) : i_(new int(i)) {}
+    S(const S &rhs) : i_(new int(*rhs.i_)) {}
+    S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
+    ~S () { delete i_; i_ = NULL; }
+    bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
+    int get () const { return *i_; }
+    int *i_;
+    };
+
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 0, 0, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2;
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c1;
+        C c2;
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {  // LWG issue #526
+    typedef int T;
+    typedef std::forward_list<T> C;
+    int t1[] = {1, 2, 1, 3, 5, 8, 11};
+    int t2[] = {   2,    3, 5, 8, 11};
+    C c1(std::begin(t1), std::end(t1));
+    C c2(std::begin(t2), std::end(t2));
+    c1.remove(c1.front());
+    assert(c1 == c2);
+    }
+    {
+    typedef S T;
+    typedef std::forward_list<T> C;
+    int t1[] = {1, 2, 1, 3, 5, 8, 11, 1};
+    int t2[] = {   2,    3, 5, 8, 11   };
+    C c;
+    for(int *ip = std::end(t1); ip != std::begin(t1);)
+        c.push_front(S(*--ip));
+    c.remove(c.front());
+    C::const_iterator it = c.begin();
+    for(int *ip = std::begin(t2); ip != std::end(t2); ++ip, ++it) {
+        assert ( it != c.end());
+        assert ( *ip == it->get());
+        }
+    assert ( it == c.end ());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 0, 0, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2;
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c1;
+        C c2;
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.remove(0);
+        assert(c1 == c2);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class Predicate> void remove_if(Predicate pred);
+
+#include <forward_list>
+#include <iterator>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "counting_predicates.hpp"
+
+
+bool g(int i)
+{
+    return i < 3;
+}
+
+int main()
+{
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 0, 0, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2;
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T> C;
+        C c1;
+        C c2;
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == 0);
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 0, 0, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2;
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c1;
+        C c2;
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == 0);
+    }
+    {
+        typedef int T;
+        typedef unary_counting_predicate<bool(*)(T), T> Predicate;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 5, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        Predicate cp(g);
+        c1.remove_if(std::ref(cp));
+        assert(c1 == c2);
+        assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/reverse.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void reverse();
+
+#include <forward_list>
+#include <iterator>
+#include <algorithm>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+void test(int N)
+{
+    C c;
+    for (int i = 0; i < N; ++i)
+        c.push_front(i);
+    c.reverse();
+    assert(distance(c.begin(), c.end()) == N);
+    typename C::const_iterator j = c.begin();
+    for (int i = 0; i < N; ++i, ++j)
+        assert(*j == i);
+}
+
+int main()
+{
+    for (int i = 0; i < 10; ++i)
+        test<std::forward_list<int> >(i);
+#if __cplusplus >= 201103L
+    for (int i = 0; i < 10; ++i)
+        test<std::forward_list<int, min_allocator<int>> >(i);
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void sort();
+
+#include <forward_list>
+#include <iterator>
+#include <algorithm>
+#include <vector>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+void test(int N)
+{
+    typedef typename C::value_type T;
+    typedef std::vector<T> V;
+    V v;
+    for (int i = 0; i < N; ++i)
+        v.push_back(i);
+    std::random_shuffle(v.begin(), v.end());
+    C c(v.begin(), v.end());
+    c.sort();
+    assert(distance(c.begin(), c.end()) == N);
+    typename C::const_iterator j = c.begin();
+    for (int i = 0; i < N; ++i, ++j)
+        assert(*j == i);
+}
+
+int main()
+{
+    for (int i = 0; i < 40; ++i)
+        test<std::forward_list<int> >(i);
+#if __cplusplus >= 201103L
+    for (int i = 0; i < 40; ++i)
+        test<std::forward_list<int, min_allocator<int>> >(i);
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class Compare> void sort(Compare comp);
+
+#include <forward_list>
+#include <iterator>
+#include <algorithm>
+#include <vector>
+#include <functional>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+void test(int N)
+{
+    typedef typename C::value_type T;
+    typedef std::vector<T> V;
+    V v;
+    for (int i = 0; i < N; ++i)
+        v.push_back(i);
+    std::random_shuffle(v.begin(), v.end());
+    C c(v.begin(), v.end());
+    c.sort(std::greater<T>());
+    assert(distance(c.begin(), c.end()) == N);
+    typename C::const_iterator j = c.begin();
+    for (int i = 0; i < N; ++i, ++j)
+        assert(*j == N-1-i);
+}
+
+int main()
+{
+    for (int i = 0; i < 40; ++i)
+        test<std::forward_list<int> >(i);
+#if __cplusplus >= 201103L
+    for (int i = 0; i < 40; ++i)
+        test<std::forward_list<int, min_allocator<int>> >(i);
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void splice_after(const_iterator p, forward_list&& x);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+typedef int T;
+const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
+const T t2[] = {10, 11, 12, 13, 14, 15};
+const int size_t1 = std::end(t1) - std::begin(t1);
+const int size_t2 = std::end(t2) - std::begin(t2);
+
+template <class C>
+void
+testd(const C& c, int p, int l)
+{
+    typename C::const_iterator i = c.begin();
+    int n1 = 0;
+    for (; n1 < p; ++n1, ++i)
+        assert(*i == t1[n1]);
+    for (int n2 = 0; n2 < l; ++n2, ++i)
+        assert(*i == t2[n2]);
+    for (; n1 < size_t1; ++n1, ++i)
+        assert(*i == t1[n1]);
+    assert(distance(c.begin(), c.end()) == size_t1 + l);
+}
+
+int main()
+{
+    {
+    // splicing different containers
+    typedef std::forward_list<T> C;
+    for (int l = 0; l <= size_t2; ++l)
+    {
+        for (int p = 0; p <= size_t1; ++p)
+        {
+            C c1(std::begin(t1), std::end(t1));
+            C c2(t2, t2+l);
+
+            c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2));
+            testd(c1, p, l);
+        }
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    // splicing different containers
+    typedef std::forward_list<T, min_allocator<T>> C;
+    for (int l = 0; l <= size_t2; ++l)
+    {
+        for (int p = 0; p <= size_t1; ++p)
+        {
+            C c1(std::begin(t1), std::end(t1));
+            C c2(t2, t2+l);
+
+            c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2));
+            testd(c1, p, l);
+        }
+    }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,140 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void splice_after(const_iterator p, forward_list&& x, const_iterator i);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+typedef int T;
+const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
+const T t2[] = {10, 11, 12};
+const int size_t1 = std::end(t1) - std::begin(t1);
+const int size_t2 = std::end(t2) - std::begin(t2);
+
+template <class C>
+void
+testd(const C& c, int p, int f)
+{
+    typename C::const_iterator i = c.begin();
+    int n1 = 0;
+    for (; n1 < p; ++n1, ++i)
+        assert(*i == t1[n1]);
+    for (int n2 = f; n2 < f+1; ++n2, ++i)
+        assert(*i == t2[n2]);
+    for (; n1 < size_t1; ++n1, ++i)
+        assert(*i == t1[n1]);
+    assert(distance(c.begin(), c.end()) == size_t1 + 1);
+}
+
+template <class C>
+void
+tests(const C& c, int p, int f)
+{
+    typename C::const_iterator i = c.begin();
+    int n = 0;
+    int d = 1;
+    if (p == f || p == f+1)
+    {
+        for (n = 0; n < size_t1; ++n, ++i)
+            assert(*i == t1[n]);
+    }
+    else if (p < f)
+    {
+        for (n = 0; n < p; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = f; n < f+1; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = p; n < f; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = f+1; n < size_t1; ++n, ++i)
+            assert(*i == t1[n]);
+    }
+    else // p > f+1
+    {
+        for (n = 0; n < f; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = f+1; n < p; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = f; n < f+1; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = p; n < size_t1; ++n, ++i)
+            assert(*i == t1[n]);
+    }
+    assert(distance(c.begin(), c.end()) == size_t1);
+}
+
+int main()
+{
+    {
+    // splicing different containers
+    typedef std::forward_list<T> C;
+    for (int f = 0; f <= size_t2-1; ++f)
+    {
+        for (int p = 0; p <= size_t1; ++p)
+        {
+            C c1(std::begin(t1), std::end(t1));
+            C c2(std::begin(t2), std::end(t2));
+
+            c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2),
+                  next(c2.cbefore_begin(), f));
+            testd(c1, p, f);
+        }
+    }
+
+    // splicing within same container
+    for (int f = 0; f <= size_t1-1; ++f)
+    {
+        for (int p = 0; p <= size_t1; ++p)
+        {
+            C c1(std::begin(t1), std::end(t1));
+
+            c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1),
+                  next(c1.cbefore_begin(), f));
+            tests(c1, p, f);
+        }
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    // splicing different containers
+    typedef std::forward_list<T, min_allocator<T>> C;
+    for (int f = 0; f <= size_t2-1; ++f)
+    {
+        for (int p = 0; p <= size_t1; ++p)
+        {
+            C c1(std::begin(t1), std::end(t1));
+            C c2(std::begin(t2), std::end(t2));
+
+            c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2),
+                  next(c2.cbefore_begin(), f));
+            testd(c1, p, f);
+        }
+    }
+
+    // splicing within same container
+    for (int f = 0; f <= size_t1-1; ++f)
+    {
+        for (int p = 0; p <= size_t1; ++p)
+        {
+            C c1(std::begin(t1), std::end(t1));
+
+            c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1),
+                  next(c1.cbefore_begin(), f));
+            tests(c1, p, f);
+        }
+    }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_range.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,169 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void splice_after(const_iterator p, forward_list&& x,
+//                   const_iterator first, const_iterator last);
+
+#include <forward_list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+typedef int T;
+const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
+const T t2[] = {10, 11, 12, 13, 14, 15};
+const int size_t1 = std::end(t1) - std::begin(t1);
+const int size_t2 = std::end(t2) - std::begin(t2);
+
+template <class C>
+void
+testd(const C& c, int p, int f, int l)
+{
+    typename C::const_iterator i = c.begin();
+    int n1 = 0;
+    for (; n1 < p; ++n1, ++i)
+        assert(*i == t1[n1]);
+    for (int n2 = f; n2 < l-1; ++n2, ++i)
+        assert(*i == t2[n2]);
+    for (; n1 < size_t1; ++n1, ++i)
+        assert(*i == t1[n1]);
+    assert(distance(c.begin(), c.end()) == size_t1 + (l > f+1 ? l-1-f : 0));
+}
+
+template <class C>
+void
+tests(const C& c, int p, int f, int l)
+{
+    typename C::const_iterator i = c.begin();
+    int n = 0;
+    int d = l > f+1 ? l-1-f : 0;
+    if (d == 0 || p == f)
+    {
+        for (n = 0; n < size_t1; ++n, ++i)
+            assert(*i == t1[n]);
+    }
+    else if (p < f)
+    {
+        for (n = 0; n < p; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = f; n < l-1; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = p; n < f; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = l-1; n < size_t1; ++n, ++i)
+            assert(*i == t1[n]);
+    }
+    else // p > f
+    {
+        for (n = 0; n < f; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = l-1; n < p; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = f; n < l-1; ++n, ++i)
+            assert(*i == t1[n]);
+        for (n = p; n < size_t1; ++n, ++i)
+            assert(*i == t1[n]);
+    }
+    assert(distance(c.begin(), c.end()) == size_t1);
+}
+
+int main()
+{
+    {
+    // splicing different containers
+    typedef std::forward_list<T> C;
+    for (int f = 0; f <= size_t2+1; ++f)
+    {
+        for (int l = f; l <= size_t2+1; ++l)
+        {
+            for (int p = 0; p <= size_t1; ++p)
+            {
+                C c1(std::begin(t1), std::end(t1));
+                C c2(std::begin(t2), std::end(t2));
+
+                c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2),
+                      next(c2.cbefore_begin(), f), next(c2.cbefore_begin(), l));
+                testd(c1, p, f, l);
+            }
+        }
+    }
+
+    // splicing within same container
+    for (int f = 0; f <= size_t1+1; ++f)
+    {
+        for (int l = f; l <= size_t1; ++l)
+        {
+            for (int p = 0; p <= f; ++p)
+            {
+                C c1(std::begin(t1), std::end(t1));
+
+                c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1),
+                      next(c1.cbefore_begin(), f), next(c1.cbefore_begin(), l));
+                tests(c1, p, f, l);
+            }
+            for (int p = l; p <= size_t1; ++p)
+            {
+                C c1(std::begin(t1), std::end(t1));
+
+                c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1),
+                      next(c1.cbefore_begin(), f), next(c1.cbefore_begin(), l));
+                tests(c1, p, f, l);
+            }
+        }
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    // splicing different containers
+    typedef std::forward_list<T, min_allocator<T>> C;
+    for (int f = 0; f <= size_t2+1; ++f)
+    {
+        for (int l = f; l <= size_t2+1; ++l)
+        {
+            for (int p = 0; p <= size_t1; ++p)
+            {
+                C c1(std::begin(t1), std::end(t1));
+                C c2(std::begin(t2), std::end(t2));
+
+                c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2),
+                      next(c2.cbefore_begin(), f), next(c2.cbefore_begin(), l));
+                testd(c1, p, f, l);
+            }
+        }
+    }
+
+    // splicing within same container
+    for (int f = 0; f <= size_t1+1; ++f)
+    {
+        for (int l = f; l <= size_t1; ++l)
+        {
+            for (int p = 0; p <= f; ++p)
+            {
+                C c1(std::begin(t1), std::end(t1));
+
+                c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1),
+                      next(c1.cbefore_begin(), f), next(c1.cbefore_begin(), l));
+                tests(c1, p, f, l);
+            }
+            for (int p = l; p <= size_t1; ++p)
+            {
+                C c1(std::begin(t1), std::end(t1));
+
+                c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1),
+                      next(c1.cbefore_begin(), f), next(c1.cbefore_begin(), l));
+                tests(c1, p, f, l);
+            }
+        }
+    }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void unique();
+
+#include <forward_list>
+#include <iterator>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {0, 5, 0, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 0, 0, 0};
+        const T t2[] = {0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c1;
+        C c2;
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {0, 5, 0, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 0, 0, 0};
+        const T t2[] = {0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c1;
+        C c2;
+        c1.unique();
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique();
+        assert(c1 == c2);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/unique_pred.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,125 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
+
+#include <forward_list>
+#include <iterator>
+#include <cassert>
+
+#include "min_allocator.h"
+
+bool g(int x, int y)
+{
+    return x == y;
+}
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {0, 5, 0, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {0, 0, 0, 0};
+        const T t2[] = {0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c1;
+        C c2;
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 5, 5, 0, 0, 0, 5};
+        const T t2[] = {0, 5, 0, 5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {0, 0, 0, 0};
+        const T t2[] = {0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5};
+        const T t2[] = {5};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c1;
+        C c2;
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        const T t1[] = {5, 5, 5, 0};
+        const T t2[] = {5, 0};
+        C c1(std::begin(t1), std::end(t1));
+        C c2(std::begin(t2), std::end(t2));
+        c1.unique(g);
+        assert(c1 == c2);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class T, class Allocator>
+//     bool operator==(const forward_list<T, Allocator>& x,
+//                     const forward_list<T, Allocator>& y);
+//
+// template <class T, class Allocator>
+//     bool operator!=(const forward_list<T, Allocator>& x,
+//                     const forward_list<T, Allocator>& y);
+
+#include <forward_list>
+#include <iterator>
+#include <algorithm>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+void test(int N, int M)
+{
+    typedef typename C::value_type T;
+    C c1;
+    for (int i = 0; i < N; ++i)
+        c1.push_front(i);
+    C c2;
+    for (int i = 0; i < M; ++i)
+        c2.push_front(i);
+    if (N == M)
+        assert(c1 == c2);
+    else
+        assert(c1 != c2);
+    c2 = c1;
+    assert(c1 == c2);
+    if (N > 0)
+    {
+        c2.front() = N+1;
+        assert(c1 != c2);
+    }
+}
+
+int main()
+{
+    for (int i = 0; i < 10; ++i)
+        for (int j = 0; j < 10; ++j)
+            test<std::forward_list<int> >(i, j);
+#if __cplusplus >= 201103L
+    for (int i = 0; i < 10; ++i)
+        for (int j = 0; j < 10; ++j)
+            test<std::forward_list<int, min_allocator<int>> >(i, j);
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,259 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void swap(forward_list& x);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(2));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        C c2(A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(2));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(2));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        C c2(A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(2));
+    }
+
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(1));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        C c2(A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(1));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(1));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        C c2(A(2));
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(1));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A());
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A());
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A());
+    }
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A());
+        C c2(A{});
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A());
+    }
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A{});
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A());
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A());
+    }
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A{});
+        C c2(A{});
+        c1.swap(c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,260 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class T, class Allocator>
+//     void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y);
+
+#include <forward_list>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(2));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        C c2(A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(2));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(2));
+    }
+    {
+        typedef int T;
+        typedef test_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        C c2(A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(1));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(2));
+    }
+
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(1));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A(1));
+        C c2(A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A(1));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(1));
+    }
+    {
+        typedef int T;
+        typedef other_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A(1));
+        C c2(A(2));
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A(2));
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A(1));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A());
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A());
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A());
+    }
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        const T t1[] = {0, 1, 2, 3, 4, 5};
+        C c1(std::begin(t1), std::end(t1), A());
+        C c2(A{});
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 6);
+        assert(*next(c2.begin(), 0) == 0);
+        assert(*next(c2.begin(), 1) == 1);
+        assert(*next(c2.begin(), 2) == 2);
+        assert(*next(c2.begin(), 3) == 3);
+        assert(*next(c2.begin(), 4) == 4);
+        assert(*next(c2.begin(), 5) == 5);
+        assert(c2.get_allocator() == A());
+    }
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A{});
+        const T t2[] = {10, 11, 12};
+        C c2(std::begin(t2), std::end(t2), A());
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 3);
+        assert(*next(c1.begin(), 0) == 10);
+        assert(*next(c1.begin(), 1) == 11);
+        assert(*next(c1.begin(), 2) == 12);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A());
+    }
+    {
+        typedef int T;
+        typedef min_allocator<T> A;
+        typedef std::forward_list<T, A> C;
+        C c1(A{});
+        C c2(A{});
+        swap(c1, c2);
+
+        assert(distance(c1.begin(), c1.end()) == 0);
+        assert(c1.get_allocator() == A());
+
+        assert(distance(c2.begin(), c2.end()) == 0);
+        assert(c2.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class T, class Allocator>
+//     bool operator< (const forward_list<T, Allocator>& x,
+//                     const forward_list<T, Allocator>& y);
+//
+// template <class T, class Allocator>
+//     bool operator> (const forward_list<T, Allocator>& x,
+//                     const forward_list<T, Allocator>& y);
+//
+// template <class T, class Allocator>
+//     bool operator>=(const forward_list<T, Allocator>& x,
+//                     const forward_list<T, Allocator>& y);
+//
+// template <class T, class Allocator>
+//     bool operator<=(const forward_list<T, Allocator>& x,
+//                     const forward_list<T, Allocator>& y);
+
+#include <forward_list>
+#include <iterator>
+#include <algorithm>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class C>
+void test(int N, int M)
+{
+    typedef typename C::value_type T;
+    C c1;
+    for (int i = 0; i < N; ++i)
+        c1.push_front(i);
+    C c2;
+    for (int i = 0; i < M; ++i)
+        c2.push_front(i);
+    if (N < M)
+        assert(c1 < c2);
+    if (N <= M)
+        assert(c1 <= c2);
+    if (N >= M)
+        assert(c1 >= c2);
+    if (N > M)
+        assert(c1 > c2);
+}
+
+int main()
+{
+    for (int i = 0; i < 10; ++i)
+        for (int j = 0; j < 10; ++j)
+            test<std::forward_list<int> >(i, j);
+#if __cplusplus >= 201103L
+    for (int i = 0; i < 10; ++i)
+        for (int j = 0; j < 10; ++j)
+            test<std::forward_list<int, min_allocator<int>> >(i, j);
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// void swap(forward_list& c)
+//     noexcept(!allocator_type::propagate_on_container_swap::value ||
+//              __is_nothrow_swappable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <forward_list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    
+    some_alloc() {}
+    some_alloc(const some_alloc&);
+    void deallocate(void*, unsigned) {}
+
+    typedef std::true_type propagate_on_container_swap;
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::forward_list<MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
+        C c1, c2;
+        static_assert(!noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/max_size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// size_type max_size() const;
+
+#include <forward_list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::forward_list<T> C;
+        C c;
+        assert(c.max_size() > 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::forward_list<T, min_allocator<T>> C;
+        C c;
+        assert(c.max_size() > 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+// template <class T, class Allocator = allocator<T>>
+// class forward_list
+// {
+// public:
+//   typedef T         value_type;
+//   typedef Allocator allocator_type;
+//
+//   typedef value_type&                                                reference;
+//   typedef const value_type&                                          const_reference;
+//   typedef typename allocator_traits<allocator_type>::pointer         pointer;
+//   typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
+//   typedef typename allocator_traits<allocator_type>::size_type       size_type;
+//   typedef typename allocator_traits<allocator_type>::difference_type difference_type;
+//   ...
+// };
+
+#include <forward_list>
+#include <type_traits>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::forward_list<char> C;
+    static_assert((std::is_same<C::value_type, char>::value), "");
+    static_assert((std::is_same<C::allocator_type, std::allocator<char> >::value), "");
+    static_assert((std::is_same<C::reference, char&>::value), "");
+    static_assert((std::is_same<C::const_reference, const char&>::value), "");
+    static_assert((std::is_same<C::pointer, char*>::value), "");
+    static_assert((std::is_same<C::const_pointer, const char*>::value), "");
+    static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+    static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::forward_list<char, min_allocator<char>> C;
+    static_assert((std::is_same<C::value_type, char>::value), "");
+    static_assert((std::is_same<C::allocator_type, min_allocator<char> >::value), "");
+    static_assert((std::is_same<C::reference, char&>::value), "");
+    static_assert((std::is_same<C::const_reference, const char&>::value), "");
+    static_assert((std::is_same<C::pointer, min_pointer<char>>::value), "");
+    static_assert((std::is_same<C::const_pointer, min_pointer<const char>>::value), "");
+//  min_allocator doesn't have a size_type, so one gets synthesized
+    static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
+    static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/forwardlist/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/version.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+
+#include <forward_list>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/sequences/list/db_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call back() on empty container.
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int T;
+    typedef std::list<T> C;
+    C c(1);
+    assert(c.back() == 0);
+    c.clear();
+    assert(c.back() == 0);
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int T;
+    typedef std::list<T, min_allocator<T>> C;
+    C c(1);
+    assert(c.back() == 0);
+    c.clear();
+    assert(c.back() == 0);
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/db_cback.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_cback.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_cback.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_cback.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call back() on empty const container.
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int T;
+    typedef std::list<T> C;
+    const C c;
+    assert(c.back() == 0);
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int T;
+    typedef std::list<T, min_allocator<T>> C;
+    const C c;
+    assert(c.back() == 0);
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/db_cfront.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_cfront.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_cfront.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_cfront.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call front() on empty const container.
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int T;
+    typedef std::list<T> C;
+    const C c;
+    assert(c.front() == 0);
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int T;
+    typedef std::list<T, min_allocator<T>> C;
+    const C c;
+    assert(c.front() == 0);
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/db_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call front() on empty container.
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int T;
+    typedef std::list<T> C;
+    C c(1);
+    assert(c.front() == 0);
+    c.clear();
+    assert(c.front() == 0);
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int T;
+    typedef std::list<T, min_allocator<T>> C;
+    C c(1);
+    assert(c.front() == 0);
+    c.clear();
+    assert(c.front() == 0);
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/db_iterators_6.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_iterators_6.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_iterators_6.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_iterators_6.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Decrement iterator prior to begin.
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int T;
+    typedef std::list<T> C;
+    C c(1);
+    C::iterator i = c.end();
+    --i;
+    assert(i == c.begin());
+    --i;
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int T;
+    typedef std::list<T, min_allocator<T>> C;
+    C c(1);
+    C::iterator i = c.end();
+    --i;
+    assert(i == c.begin());
+    --i;
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/db_iterators_7.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_iterators_7.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_iterators_7.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_iterators_7.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Increment iterator past end.
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int T;
+    typedef std::list<T> C;
+    C c(1);
+    C::iterator i = c.begin();
+    ++i;
+    assert(i == c.end());
+    ++i;
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int T;
+    typedef std::list<T, min_allocator<T>> C;
+    C c(1);
+    C::iterator i = c.begin();
+    ++i;
+    assert(i == c.end());
+    ++i;
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/db_iterators_8.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_iterators_8.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_iterators_8.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_iterators_8.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Dereference non-dereferenceable iterator.
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef int T;
+    typedef std::list<T> C;
+    C c(1);
+    C::iterator i = c.end();
+    T j = *i;
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int T;
+    typedef std::list<T, min_allocator<T>> C;
+    C c(1);
+    C::iterator i = c.end();
+    T j = *i;
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/db_iterators_9.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/db_iterators_9.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/db_iterators_9.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/db_iterators_9.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Operations on "NULL" iterators
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) do { if (!x) throw 1; } while(0)
+
+#include <list>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+struct S { int val; };
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+    {
+    unsigned lib_asserts;
+
+    typedef S T;
+    typedef std::list<T> C;
+    C::iterator i{};
+    C::const_iterator ci{};
+    
+    lib_asserts = 0;
+    try { ++i; }  catch (int) { ++lib_asserts; }
+    try { i++; }  catch (int) { ++lib_asserts; }
+    try { ++ci; } catch (int) { ++lib_asserts; }
+    try { ci++; } catch (int) { ++lib_asserts; }
+    assert(lib_asserts == 4);
+
+    lib_asserts = 0;
+    try { --i; }  catch (int) { ++lib_asserts; }
+    try { i--; }  catch (int) { ++lib_asserts; }
+    try { --ci; } catch (int) { ++lib_asserts; }
+    try { ci--; } catch (int) { ++lib_asserts; }
+    assert(lib_asserts == 4);
+
+    lib_asserts = 0;
+    try { *i; }             catch (int) { ++lib_asserts; }
+    try { *ci; }            catch (int) { ++lib_asserts; }
+    try { (void)  i->val; } catch (int) { ++lib_asserts; }
+    try { (void) ci->val; } catch (int) { ++lib_asserts; }
+    assert(lib_asserts == 4);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/iterators.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/iterators.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/iterators.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,159 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator       begin();
+// iterator       end();
+// const_iterator begin()  const;
+// const_iterator end()    const;
+// const_iterator cbegin() const;
+// const_iterator cend()   const;
+
+#include <list>
+#include <cassert>
+#include <iterator>
+
+#include "min_allocator.h"
+
+struct A
+{
+    int first;
+    int second;
+};
+
+int main()
+{
+    {
+        typedef int T;
+        typedef std::list<T> C;
+        C c;
+        C::iterator i = c.begin();
+        C::iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::list<T> C;
+        const C c;
+        C::const_iterator i = c.begin();
+        C::const_iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::list<T> C;
+        C c;
+        C::const_iterator i = c.cbegin();
+        C::const_iterator j = c.cend();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+        assert(i == c.end());
+    }
+    {
+        typedef int T;
+        typedef std::list<T> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        C::iterator i = c.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 1);
+        *i = 10;
+        assert(*i == 10);
+        assert(std::distance(c.begin(), c.end()) == 10);
+    }
+    {
+        typedef int T;
+        typedef std::list<T> C;
+        C::iterator i;
+        C::const_iterator j;
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef int T;
+        typedef std::list<T, min_allocator<T>> C;
+        C c;
+        C::iterator i = c.begin();
+        C::iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::list<T, min_allocator<T>> C;
+        const C c;
+        C::const_iterator i = c.begin();
+        C::const_iterator j = c.end();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+    }
+    {
+        typedef int T;
+        typedef std::list<T, min_allocator<T>> C;
+        C c;
+        C::const_iterator i = c.cbegin();
+        C::const_iterator j = c.cend();
+        assert(std::distance(i, j) == 0);
+        assert(i == j);
+        assert(i == c.end());
+    }
+    {
+        typedef int T;
+        typedef std::list<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        C c(std::begin(t), std::end(t));
+        C::iterator i = c.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 1);
+        *i = 10;
+        assert(*i == 10);
+        assert(std::distance(c.begin(), c.end()) == 10);
+    }
+    {
+        typedef int T;
+        typedef std::list<T, min_allocator<T>> C;
+        C::iterator i;
+        C::const_iterator j;
+    }
+    {
+        typedef A T;
+        typedef std::list<T, min_allocator<T>> C;
+        C c = {A{1, 2}};
+        C::iterator i = c.begin();
+        i->first = 3;
+        C::const_iterator j = i;
+        assert(j->first == 3);
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+        std::list<int> c;
+        std::list<int>::iterator ii1{}, ii2{};
+        std::list<int>::iterator ii4 = ii1;
+        std::list<int>::const_iterator cii{};
+        assert ( ii1 == ii2 );
+        assert ( ii1 == ii4 );
+
+        assert (!(ii1 != ii2 ));
+
+        assert ( (ii1 == cii ));
+        assert ( (cii == ii1 ));
+        assert (!(ii1 != cii ));
+        assert (!(cii != ii1 ));
+
+        assert ( ii1 != c.cbegin());
+        assert ( cii != c.begin());
+    }
+#endif
+
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void resize(size_type sz);
+
+#include <list>
+#include <cassert>
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<int> l(5, 2);
+        l.resize(2);
+        assert(l.size() == 2);
+        assert(std::distance(l.begin(), l.end()) == 2);
+        assert(l == std::list<int>(2, 2));
+    }
+    {
+        std::list<int> l(5, 2);
+        l.resize(10);
+        assert(l.size() == 10);
+        assert(std::distance(l.begin(), l.end()) == 10);
+        assert(l.front() == 2);
+        assert(l.back() == 0);
+    }
+#ifdef __LIBCPP_MOVE
+    {
+        std::list<DefaultOnly> l(10);
+        l.resize(5);
+        assert(l.size() == 5);
+        assert(std::distance(l.begin(), l.end()) == 5);
+    }
+    {
+        std::list<DefaultOnly> l(10);
+        l.resize(20);
+        assert(l.size() == 20);
+        assert(std::distance(l.begin(), l.end()) == 20);
+    }
+#endif  // __LIBCPP_MOVE
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int>> l(5, 2);
+        l.resize(2);
+        assert(l.size() == 2);
+        assert(std::distance(l.begin(), l.end()) == 2);
+        assert((l == std::list<int, min_allocator<int>>(2, 2)));
+    }
+    {
+        std::list<int, min_allocator<int>> l(5, 2);
+        l.resize(10);
+        assert(l.size() == 10);
+        assert(std::distance(l.begin(), l.end()) == 10);
+        assert(l.front() == 2);
+        assert(l.back() == 0);
+    }
+#ifdef __LIBCPP_MOVE
+    {
+        std::list<DefaultOnly, min_allocator<DefaultOnly>> l(10);
+        l.resize(5);
+        assert(l.size() == 5);
+        assert(std::distance(l.begin(), l.end()) == 5);
+    }
+    {
+        std::list<DefaultOnly, min_allocator<DefaultOnly>> l(10);
+        l.resize(20);
+        assert(l.size() == 20);
+        assert(std::distance(l.begin(), l.end()) == 20);
+    }
+#endif  // __LIBCPP_MOVE
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.capacity/resize_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void resize(size_type sz, const value_type& x);
+
+#include <list>
+#include <cassert>
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<double> l(5, 2);
+        l.resize(2, 3.5);
+        assert(l.size() == 2);
+        assert(std::distance(l.begin(), l.end()) == 2);
+        assert(l == std::list<double>(2, 2));
+    }
+    {
+        std::list<double> l(5, 2);
+        l.resize(10, 3.5);
+        assert(l.size() == 10);
+        assert(std::distance(l.begin(), l.end()) == 10);
+        assert(l.front() == 2);
+        assert(l.back() == 3.5);
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<double, min_allocator<double>> l(5, 2);
+        l.resize(2, 3.5);
+        assert(l.size() == 2);
+        assert(std::distance(l.begin(), l.end()) == 2);
+        assert((l == std::list<double, min_allocator<double>>(2, 2)));
+    }
+    {
+        std::list<double, min_allocator<double>> l(5, 2);
+        l.resize(10, 3.5);
+        assert(l.size() == 10);
+        assert(std::distance(l.begin(), l.end()) == 10);
+        assert(l.front() == 2);
+        assert(l.back() == 3.5);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list& operator=(const list& c);
+
+#include <list>
+#include <cassert>
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+        std::list<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+        l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == test_allocator<int>(3));
+    }
+    {
+        std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+        std::list<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+        l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == other_allocator<int>(5));
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+        std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
+        l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == min_allocator<int>());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void assign(initializer_list<value_type> il);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::list<int> d;
+    d.assign({3, 4, 5, 6});
+    assert(d.size() == 4);
+    std::list<int>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<int, min_allocator<int>> d;
+    d.assign({3, 4, 5, 6});
+    assert(d.size() == 4);
+    std::list<int, min_allocator<int>>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list& operator=(list&& c);
+
+#include <list>
+#include <cassert>
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+        std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(5));
+        l2 = std::move(l);
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == lo.get_allocator());
+    }
+    {
+        std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+        std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, test_allocator<MoveOnly> > l2(test_allocator<MoveOnly>(6));
+        l2 = std::move(l);
+        assert(l2 == lo);
+        assert(!l.empty());
+        assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+    }
+    {
+        std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+        std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, other_allocator<MoveOnly> > l2(other_allocator<MoveOnly>(6));
+        l2 = std::move(l);
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == lo.get_allocator());
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
+        std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, min_allocator<MoveOnly> > l2(min_allocator<MoveOnly>{});
+        l2 = std::move(l);
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == lo.get_allocator());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(const list& c);
+
+#include <list>
+#include <cassert>
+#include "DefaultOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<int> l(3, 2);
+        std::list<int> l2 = l;
+        assert(l2 == l);
+    }
+    {
+        std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+        std::list<int, test_allocator<int> > l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == l.get_allocator());
+    }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+        std::list<int, other_allocator<int> > l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == other_allocator<int>(-2));
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int>> l(3, 2);
+        std::list<int, min_allocator<int>> l2 = l;
+        assert(l2 == l);
+    }
+    {
+        std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+        std::list<int, min_allocator<int> > l2 = l;
+        assert(l2 == l);
+        assert(l2.get_allocator() == l.get_allocator());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/copy_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(const list& c, const allocator_type& a);
+
+#include <list>
+#include <cassert>
+#include "DefaultOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<int, test_allocator<int> > l(3, 2, test_allocator<int>(5));
+        std::list<int, test_allocator<int> > l2(l, test_allocator<int>(3));
+        assert(l2 == l);
+        assert(l2.get_allocator() == test_allocator<int>(3));
+    }
+    {
+        std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
+        std::list<int, other_allocator<int> > l2(l, other_allocator<int>(3));
+        assert(l2 == l);
+        assert(l2.get_allocator() == other_allocator<int>(3));
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int> > l(3, 2, min_allocator<int>());
+        std::list<int, min_allocator<int> > l2(l, min_allocator<int>());
+        assert(l2 == l);
+        assert(l2.get_allocator() == min_allocator<int>());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// explicit list(const Alloc& = Alloc());
+
+#include <list>
+#include <cassert>
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<int> l;
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<DefaultOnly> l;
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<int> l((std::allocator<int>()));
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int>> l;
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<DefaultOnly, min_allocator<DefaultOnly>> l;
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<int, min_allocator<int>> l((min_allocator<int>()));
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<int> l = {};
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list()
+//        noexcept(is_nothrow_default_constructible<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::list<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// explicit list(const Alloc& = Alloc());
+
+#include <list>
+#include <cassert>
+#include "../../../stack_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<int> l;
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<int> l((std::allocator<int>()));
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<int, stack_allocator<int, 4> > l;
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int>> l;
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+    {
+        std::list<int, min_allocator<int>> l((min_allocator<int>()));
+        assert(l.size() == 0);
+        assert(std::distance(l.begin(), l.end()) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// ~list() // implied noexcept;
+
+#include <list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+#if __has_feature(cxx_noexcept)
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+    ~some_alloc() noexcept(false);
+};
+
+#endif
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::list<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(initializer_list<value_type> il);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::list<int> d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    std::list<int>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<int, min_allocator<int>> d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    std::list<int, min_allocator<int>>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(initializer_list<value_type> il, const Allocator& a = allocator_type());
+
+#include <list>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::list<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
+    assert(d.get_allocator() == test_allocator<int>(3));
+    assert(d.size() == 4);
+    std::list<int>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
+    assert(d.get_allocator() == min_allocator<int>());
+    assert(d.size() == 4);
+    std::list<int, min_allocator<int>>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class InputIterator>
+//   list(InputIterator first, InputIterator last, const Allocator& = Allocator());
+
+#include <list>
+#include <cassert>
+#include "test_iterators.h"
+#include "../../../stack_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        int a[] = {0, 1, 2, 3};
+        std::list<int> l(input_iterator<const int*>(a),
+                         input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])));
+        assert(l.size() == sizeof(a)/sizeof(a[0]));
+        assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
+        int j = 0;
+        for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+            assert(*i == j);
+    }
+    {
+        int a[] = {0, 1, 2, 3};
+        std::list<int> l(input_iterator<const int*>(a),
+                         input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])),
+                         std::allocator<int>());
+        assert(l.size() == sizeof(a)/sizeof(a[0]));
+        assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
+        int j = 0;
+        for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+            assert(*i == j);
+    }
+    {
+        int a[] = {0, 1, 2, 3};
+        std::list<int, stack_allocator<int, sizeof(a)/sizeof(a[0])> > l(input_iterator<const int*>(a),
+                         input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])));
+        assert(l.size() == sizeof(a)/sizeof(a[0]));
+        assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
+        int j = 0;
+        for (std::list<int>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+            assert(*i == j);
+    }
+#if __cplusplus >= 201103L
+    {
+        int a[] = {0, 1, 2, 3};
+        std::list<int, min_allocator<int>> l(input_iterator<const int*>(a),
+                         input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])));
+        assert(l.size() == sizeof(a)/sizeof(a[0]));
+        assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
+        int j = 0;
+        for (std::list<int, min_allocator<int>>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+            assert(*i == j);
+    }
+    {
+        int a[] = {0, 1, 2, 3};
+        std::list<int, min_allocator<int>> l(input_iterator<const int*>(a),
+                         input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])),
+                         min_allocator<int>());
+        assert(l.size() == sizeof(a)/sizeof(a[0]));
+        assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
+        int j = 0;
+        for (std::list<int, min_allocator<int>>::const_iterator i = l.begin(), e = l.end(); i != e; ++i, ++j)
+            assert(*i == j);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(list&& c);
+
+#include <list>
+#include <cassert>
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+        std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, test_allocator<MoveOnly> > l2 = std::move(l);
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == lo.get_allocator());
+    }
+    {
+        std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+        std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, other_allocator<MoveOnly> > l2 = std::move(l);
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == lo.get_allocator());
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
+        std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, min_allocator<MoveOnly> > l2 = std::move(l);
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == lo.get_allocator());
+    }
+#endif
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int> l1 = {1, 2, 3};
+        std::list<int>::iterator i = l1.begin();
+        std::list<int> l2 = std::move(l1);
+        assert(*l2.erase(i) == 2);
+        assert(l2.size() == 2);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(list&& c, const allocator_type& a);
+
+#include <list>
+#include <cassert>
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+        std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(6));
+        assert(l2 == lo);
+        assert(!l.empty());
+        assert(l2.get_allocator() == test_allocator<MoveOnly>(6));
+    }
+    {
+        std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
+        std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, test_allocator<MoveOnly> > l2(std::move(l), test_allocator<MoveOnly>(5));
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == test_allocator<MoveOnly>(5));
+    }
+    {
+        std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
+        std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, other_allocator<MoveOnly> > l2(std::move(l), other_allocator<MoveOnly>(4));
+        assert(l2 == lo);
+        assert(!l.empty());
+        assert(l2.get_allocator() == other_allocator<MoveOnly>(4));
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
+        std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
+        for (int i = 1; i <= 3; ++i)
+        {
+            l.push_back(i);
+            lo.push_back(i);
+        }
+        std::list<MoveOnly, min_allocator<MoveOnly> > l2(std::move(l), min_allocator<MoveOnly>());
+        assert(l2 == lo);
+        assert(l.empty());
+        assert(l2.get_allocator() == min_allocator<MoveOnly>());
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list& operator=(list&& c)
+//     noexcept(
+//          allocator_type::propagate_on_container_move_assignment::value &&
+//          is_nothrow_move_assignable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::list<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(list&&)
+//        noexcept(is_nothrow_move_constructible<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_alloc
+{
+    typedef T value_type;
+    some_alloc(const some_alloc&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+    {
+        typedef std::list<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list& operator=(initializer_list<value_type> il);
+
+#include <list>
+#include <cassert>
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::list<int> d;
+    d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    std::list<int>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<int, min_allocator<int>> d;
+    d = {3, 4, 5, 6};
+    assert(d.size() == 4);
+    std::list<int, min_allocator<int>>::iterator i = d.begin();
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// explicit list(size_type n);
+
+#include <list>
+#include <cassert>
+#include "DefaultOnly.h"
+#include "../../../stack_allocator.h"
+#include "min_allocator.h"
+
+template <class T, class Allocator>
+void
+test3(unsigned n, Allocator const &alloc = Allocator())
+{
+#if _LIBCPP_STD_VER > 11
+    typedef std::list<T, Allocator> C;
+    typedef typename C::const_iterator const_iterator;
+    {
+    C d(n, alloc);
+    assert(d.size() == n);
+    assert(std::distance(d.begin(), d.end()) == n);
+    assert(d.get_allocator() == alloc);
+    }
+#endif
+}
+
+
+int main()
+{
+    {
+        std::list<int> l(3);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int>::const_iterator i = l.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+    }
+    {
+        std::list<int, stack_allocator<int, 3> > l(3);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int>::const_iterator i = l.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+        typedef std::list<int, min_allocator<int> > C;
+        C l(3, min_allocator<int> ());
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        C::const_iterator i = l.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+        test3<int, min_allocator<int>> (3);
+    }
+#endif
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::list<DefaultOnly> l(3);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int>> l(3);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int, min_allocator<int>>::const_iterator i = l.begin();
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+        ++i;
+        assert(*i == 0);
+    }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::list<DefaultOnly, min_allocator<DefaultOnly>> l(3);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// list(size_type n, const T& value, const Allocator& = Allocator());
+
+#include <list>
+#include <cassert>
+#include "DefaultOnly.h"
+#include "../../../stack_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        std::list<int> l(3, 2);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int>::const_iterator i = l.begin();
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+    }
+    {
+        std::list<int> l(3, 2, std::allocator<int>());
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int>::const_iterator i = l.begin();
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+    }
+    {
+        std::list<int, stack_allocator<int, 3> > l(3, 2);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int>::const_iterator i = l.begin();
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int>> l(3, 2);
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int, min_allocator<int>>::const_iterator i = l.begin();
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+    }
+    {
+        std::list<int, min_allocator<int>> l(3, 2, min_allocator<int>());
+        assert(l.size() == 3);
+        assert(std::distance(l.begin(), l.end()) == 3);
+        std::list<int, min_allocator<int>>::const_iterator i = l.begin();
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+        ++i;
+        assert(*i == 2);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void clear();
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a[] = {1, 2, 3};
+    std::list<int> c(a, a+3);
+    c.clear();
+    assert(c.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+    int a[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> c(a, a+3);
+    c.clear();
+    assert(c.empty());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class... Args> void emplace(const_iterator p, Args&&... args);
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+class A
+{
+    int i_;
+    double d_;
+
+    A(const A&);
+    A& operator=(const A&);
+public:
+    A(int i, double d)
+        : i_(i), d_(d) {}
+
+    int geti() const {return i_;}
+    double getd() const {return d_;}
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<A> c;
+    c.emplace(c.cbegin(), 2, 3.5);
+    assert(c.size() == 1);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    c.emplace(c.cend(), 3, 4.5);
+    assert(c.size() == 2);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    assert(c.back().geti() == 3);
+    assert(c.back().getd() == 4.5);
+    }
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<A> c1;
+        std::list<A> c2;
+        std::list<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
+        assert(false);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<A, min_allocator<A>> c;
+    c.emplace(c.cbegin(), 2, 3.5);
+    assert(c.size() == 1);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    c.emplace(c.cend(), 3, 4.5);
+    assert(c.size() == 2);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    assert(c.back().geti() == 3);
+    assert(c.back().getd() == 4.5);
+    }
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<A, min_allocator<A>> c1;
+        std::list<A, min_allocator<A>> c2;
+        std::list<A, min_allocator<A>>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
+        assert(false);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class... Args> void emplace_back(Args&&... args);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+class A
+{
+    int i_;
+    double d_;
+
+    A(const A&);
+    A& operator=(const A&);
+public:
+    A(int i, double d)
+        : i_(i), d_(d) {}
+
+    int geti() const {return i_;}
+    double getd() const {return d_;}
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<A> c;
+    c.emplace_back(2, 3.5);
+    assert(c.size() == 1);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    c.emplace_back(3, 4.5);
+    assert(c.size() == 2);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    assert(c.back().geti() == 3);
+    assert(c.back().getd() == 4.5);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<A, min_allocator<A>> c;
+    c.emplace_back(2, 3.5);
+    assert(c.size() == 1);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    c.emplace_back(3, 4.5);
+    assert(c.size() == 2);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    assert(c.back().geti() == 3);
+    assert(c.back().getd() == 4.5);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class... Args> void emplace_front(Args&&... args);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+class A
+{
+    int i_;
+    double d_;
+
+    A(const A&);
+    A& operator=(const A&);
+public:
+    A(int i, double d)
+        : i_(i), d_(d) {}
+
+    int geti() const {return i_;}
+    double getd() const {return d_;}
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<A> c;
+    c.emplace_front(2, 3.5);
+    assert(c.size() == 1);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    c.emplace_front(3, 4.5);
+    assert(c.size() == 2);
+    assert(c.front().geti() == 3);
+    assert(c.front().getd() == 4.5);
+    assert(c.back().geti() == 2);
+    assert(c.back().getd() == 3.5);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<A, min_allocator<A>> c;
+    c.emplace_front(2, 3.5);
+    assert(c.size() == 1);
+    assert(c.front().geti() == 2);
+    assert(c.front().getd() == 3.5);
+    c.emplace_front(3, 4.5);
+    assert(c.size() == 2);
+    assert(c.front().geti() == 3);
+    assert(c.front().getd() == 4.5);
+    assert(c.back().geti() == 2);
+    assert(c.back().getd() == 3.5);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator erase(const_iterator position);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int>::const_iterator i = l1.begin();
+    ++i;
+    std::list<int>::iterator j = l1.erase(i);
+    assert(l1.size() == 2);
+    assert(distance(l1.begin(), l1.end()) == 2);
+    assert(*j == 3);
+    assert(*l1.begin() == 1);
+    assert(*next(l1.begin()) == 3);
+    j = l1.erase(j);
+    assert(j == l1.end());
+    assert(l1.size() == 1);
+    assert(distance(l1.begin(), l1.end()) == 1);
+    assert(*l1.begin() == 1);
+    j = l1.erase(l1.begin());
+    assert(j == l1.end());
+    assert(l1.size() == 0);
+    assert(distance(l1.begin(), l1.end()) == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>>::const_iterator i = l1.begin();
+    ++i;
+    std::list<int, min_allocator<int>>::iterator j = l1.erase(i);
+    assert(l1.size() == 2);
+    assert(distance(l1.begin(), l1.end()) == 2);
+    assert(*j == 3);
+    assert(*l1.begin() == 1);
+    assert(*next(l1.begin()) == 3);
+    j = l1.erase(j);
+    assert(j == l1.end());
+    assert(l1.size() == 1);
+    assert(distance(l1.begin(), l1.end()) == 1);
+    assert(*l1.begin() == 1);
+    j = l1.erase(l1.begin());
+    assert(j == l1.end());
+    assert(l1.size() == 0);
+    assert(distance(l1.begin(), l1.end()) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call erase(const_iterator position) with end()
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <cstdlib>
+#include <exception>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int>::const_iterator i = l1.end();
+    l1.erase(i);
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>>::const_iterator i = l1.end();
+    l1.erase(i);
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call erase(const_iterator position) with iterator from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <cstdlib>
+#include <exception>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int> l2(a1, a1+3);
+    std::list<int>::const_iterator i = l2.begin();
+    l1.erase(i);
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>> l2(a1, a1+3);
+    std::list<int, min_allocator<int>>::const_iterator i = l2.begin();
+    l1.erase(i);
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator erase(const_iterator first, const_iterator last);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    int a1[] = {1, 2, 3};
+    {
+        std::list<int> l1(a1, a1+3);
+        std::list<int>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
+        assert(l1.size() == 3);
+        assert(distance(l1.cbegin(), l1.cend()) == 3);
+        assert(i == l1.begin());
+    }
+    {
+        std::list<int> l1(a1, a1+3);
+        std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin()));
+        assert(l1.size() == 2);
+        assert(distance(l1.cbegin(), l1.cend()) == 2);
+        assert(i == l1.begin());
+        assert(l1 == std::list<int>(a1+1, a1+3));
+    }
+    {
+        std::list<int> l1(a1, a1+3);
+        std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2));
+        assert(l1.size() == 1);
+        assert(distance(l1.cbegin(), l1.cend()) == 1);
+        assert(i == l1.begin());
+        assert(l1 == std::list<int>(a1+2, a1+3));
+    }
+    {
+        std::list<int> l1(a1, a1+3);
+        std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3));
+        assert(l1.size() == 0);
+        assert(distance(l1.cbegin(), l1.cend()) == 0);
+        assert(i == l1.begin());
+    }
+#if __cplusplus >= 201103L
+    {
+        std::list<int, min_allocator<int>> l1(a1, a1+3);
+        std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), l1.cbegin());
+        assert(l1.size() == 3);
+        assert(distance(l1.cbegin(), l1.cend()) == 3);
+        assert(i == l1.begin());
+    }
+    {
+        std::list<int, min_allocator<int>> l1(a1, a1+3);
+        std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin()));
+        assert(l1.size() == 2);
+        assert(distance(l1.cbegin(), l1.cend()) == 2);
+        assert(i == l1.begin());
+        assert((l1 == std::list<int, min_allocator<int>>(a1+1, a1+3)));
+    }
+    {
+        std::list<int, min_allocator<int>> l1(a1, a1+3);
+        std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2));
+        assert(l1.size() == 1);
+        assert(distance(l1.cbegin(), l1.cend()) == 1);
+        assert(i == l1.begin());
+        assert((l1 == std::list<int, min_allocator<int>>(a1+2, a1+3)));
+    }
+    {
+        std::list<int, min_allocator<int>> l1(a1, a1+3);
+        std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3));
+        assert(l1.size() == 0);
+        assert(distance(l1.cbegin(), l1.cend()) == 0);
+        assert(i == l1.begin());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call erase(const_iterator first, const_iterator last); with first iterator from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int> l2(a1, a1+3);
+    std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>> l2(a1, a1+3);
+    std::list<int, min_allocator<int>>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call erase(const_iterator first, const_iterator last); with second iterator from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int> l2(a1, a1+3);
+    std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>> l2(a1, a1+3);
+    std::list<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call erase(const_iterator first, const_iterator last); with both iterators from another container
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int> l2(a1, a1+3);
+    std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>> l2(a1, a1+3);
+    std::list<int, min_allocator<int>>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Call erase(const_iterator first, const_iterator last); with a bad range
+
+#if _LIBCPP_DEBUG >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <list>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
+    assert(false);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
+    assert(false);
+    }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator insert(const_iterator p, initializer_list<value_type> il);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    std::list<int> d(10, 1);
+    std::list<int>::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6});
+    assert(d.size() == 14);
+    assert(i == next(d.begin(), 2));
+    i = d.begin();
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<int, min_allocator<int>> d(10, 1);
+    std::list<int, min_allocator<int>>::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6});
+    assert(d.size() == 14);
+    assert(i == next(d.begin(), 2));
+    i = d.begin();
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 3);
+    assert(*i++ == 4);
+    assert(*i++ == 5);
+    assert(*i++ == 6);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    assert(*i++ == 1);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,185 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <InputIterator Iter>
+//   iterator insert(const_iterator position, Iter first, Iter last);
+
+// UNSUPPORTED: asan, msan
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int throw_next = 0xFFFF;
+int count = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    if (throw_next == 0)
+        throw std::bad_alloc();
+    --throw_next;
+    ++count;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --count;
+    std::free(p);
+}
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int> l1;
+    std::list<int>::iterator i = l1.insert(l1.begin(), a1, a1+3);
+    assert(i == l1.begin());
+    assert(l1.size() == 3);
+    assert(distance(l1.begin(), l1.end()) == 3);
+    i = l1.begin();
+    assert(*i == 1);
+    ++i;
+    assert(*i == 2);
+    ++i;
+    assert(*i == 3);
+    int a2[] = {4, 5, 6};
+    i = l1.insert(i, a2, a2+3);
+    assert(*i == 4);
+    assert(l1.size() == 6);
+    assert(distance(l1.begin(), l1.end()) == 6);
+    i = l1.begin();
+    assert(*i == 1);
+    ++i;
+    assert(*i == 2);
+    ++i;
+    assert(*i == 4);
+    ++i;
+    assert(*i == 5);
+    ++i;
+    assert(*i == 6);
+    ++i;
+    assert(*i == 3);
+    throw_next = 2;
+    int save_count = count;
+    try
+    {
+        i = l1.insert(i, a2, a2+3);
+        assert(false);
+    }
+    catch (...)
+    {
+    }
+    assert(save_count == count);
+    assert(l1.size() == 6);
+    assert(distance(l1.begin(), l1.end()) == 6);
+    i = l1.begin();
+    assert(*i == 1);
+    ++i;
+    assert(*i == 2);
+    ++i;
+    assert(*i == 4);
+    ++i;
+    assert(*i == 5);
+    ++i;
+    assert(*i == 6);
+    ++i;
+    assert(*i == 3);
+    }
+    throw_next = 0xFFFF;
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int> v(100);
+        std::list<int> v2(100);
+        int a[] = {1, 2, 3, 4, 5};
+        const int N = sizeof(a)/sizeof(a[0]);
+        std::list<int>::iterator i = v.insert(next(v2.cbegin(), 10), input_iterator<const int*>(a),
+                                       input_iterator<const int*>(a+N));
+        assert(false);
+    }
+#endif
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> l1;
+    std::list<int, min_allocator<int>>::iterator i = l1.insert(l1.begin(), a1, a1+3);
+    assert(i == l1.begin());
+    assert(l1.size() == 3);
+    assert(distance(l1.begin(), l1.end()) == 3);
+    i = l1.begin();
+    assert(*i == 1);
+    ++i;
+    assert(*i == 2);
+    ++i;
+    assert(*i == 3);
+    int a2[] = {4, 5, 6};
+    i = l1.insert(i, a2, a2+3);
+    assert(*i == 4);
+    assert(l1.size() == 6);
+    assert(distance(l1.begin(), l1.end()) == 6);
+    i = l1.begin();
+    assert(*i == 1);
+    ++i;
+    assert(*i == 2);
+    ++i;
+    assert(*i == 4);
+    ++i;
+    assert(*i == 5);
+    ++i;
+    assert(*i == 6);
+    ++i;
+    assert(*i == 3);
+    throw_next = 2;
+    int save_count = count;
+    try
+    {
+        i = l1.insert(i, a2, a2+3);
+        assert(false);
+    }
+    catch (...)
+    {
+    }
+    assert(save_count == count);
+    assert(l1.size() == 6);
+    assert(distance(l1.begin(), l1.end()) == 6);
+    i = l1.begin();
+    assert(*i == 1);
+    ++i;
+    assert(*i == 2);
+    ++i;
+    assert(*i == 4);
+    ++i;
+    assert(*i == 5);
+    ++i;
+    assert(*i == 6);
+    ++i;
+    assert(*i == 3);
+    }
+#if _LIBCPP_DEBUG >= 1
+    {
+        throw_next = 0xFFFF;
+        std::list<int, min_allocator<int>> v(100);
+        std::list<int, min_allocator<int>> v2(100);
+        int a[] = {1, 2, 3, 4, 5};
+        const int N = sizeof(a)/sizeof(a[0]);
+        std::list<int, min_allocator<int>>::iterator i = v.insert(next(v2.cbegin(), 10), input_iterator<const int*>(a),
+                                       input_iterator<const int*>(a+N));
+        assert(false);
+    }
+#endif
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator insert(const_iterator position, value_type&& x);
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<MoveOnly> l1;
+    l1.insert(l1.cend(), MoveOnly(1));
+    assert(l1.size() == 1);
+    assert(l1.front() == MoveOnly(1));
+    l1.insert(l1.cbegin(), MoveOnly(2));
+    assert(l1.size() == 2);
+    assert(l1.front() == MoveOnly(2));
+    assert(l1.back() == MoveOnly(1));
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int> v1(3);
+        std::list<int> v2(3);
+        v1.insert(v2.begin(), 4);
+        assert(false);
+    }
+#endif
+#if __cplusplus >= 201103L
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<MoveOnly, min_allocator<MoveOnly>> l1;
+    l1.insert(l1.cend(), MoveOnly(1));
+    assert(l1.size() == 1);
+    assert(l1.front() == MoveOnly(1));
+    l1.insert(l1.cbegin(), MoveOnly(2));
+    assert(l1.size() == 2);
+    assert(l1.front() == MoveOnly(2));
+    assert(l1.back() == MoveOnly(1));
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int, min_allocator<int>> v1(3);
+        std::list<int, min_allocator<int>> v2(3);
+        v1.insert(v2.begin(), 4);
+        assert(false);
+    }
+#endif
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator insert(const_iterator position, size_type n, const value_type& x);
+
+// UNSUPPORTED: asan, msan
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int throw_next = 0xFFFF;
+int count = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    if (throw_next == 0)
+        throw std::bad_alloc();
+    --throw_next;
+    ++count;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --count;
+    std::free(p);
+}
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    int a2[] = {1, 4, 4, 4, 4, 4, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int>::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
+    assert(i == next(l1.begin()));
+    assert(l1 == std::list<int>(a2, a2+8));
+    throw_next = 4;
+    int save_count = count;
+    try
+    {
+        i = l1.insert(i, 5, 5);
+        assert(false);
+    }
+    catch (...)
+    {
+    }
+    throw_next = 0xFFFF;
+    assert(save_count == count);
+    assert(l1 == std::list<int>(a2, a2+8));
+    }
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int> c1(100);
+        std::list<int> c2;
+        std::list<int>::iterator i = c1.insert(next(c2.cbegin(), 10), 5, 1);
+        assert(false);
+    }
+#endif
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    int a2[] = {1, 4, 4, 4, 4, 4, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>>::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
+    assert(i == next(l1.begin()));
+    assert((l1 == std::list<int, min_allocator<int>>(a2, a2+8)));
+    throw_next = 4;
+    int save_count = count;
+    try
+    {
+        i = l1.insert(i, 5, 5);
+        assert(false);
+    }
+    catch (...)
+    {
+    }
+    throw_next = 0xFFFF;
+    assert(save_count == count);
+    assert((l1 == std::list<int, min_allocator<int>>(a2, a2+8)));
+    }
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int, min_allocator<int>> c1(100);
+        std::list<int, min_allocator<int>> c2;
+        std::list<int, min_allocator<int>>::iterator i = c1.insert(next(c2.cbegin(), 10), 5, 1);
+        assert(false);
+    }
+#endif
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// iterator insert(const_iterator position, const value_type& x);
+
+// UNSUPPORTED: asan, msan
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <list>
+#include <cstdlib>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int throw_next = 0xFFFF;
+int count = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    if (throw_next == 0)
+        throw std::bad_alloc();
+    --throw_next;
+    ++count;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --count;
+    std::free(p);
+}
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3};
+    int a2[] = {1, 4, 2, 3};
+    std::list<int> l1(a1, a1+3);
+    std::list<int>::iterator i = l1.insert(next(l1.cbegin()), 4);
+    assert(i == next(l1.begin()));
+    assert(l1.size() == 4);
+    assert(distance(l1.begin(), l1.end()) == 4);
+    assert(l1 == std::list<int>(a2, a2+4));
+    throw_next = 0;
+    int save_count = count;
+    try
+    {
+        i = l1.insert(i, 5);
+        assert(false);
+    }
+    catch (...)
+    {
+    }
+    throw_next = 0xFFFF;
+    assert(save_count == count);
+    assert(l1 == std::list<int>(a2, a2+4));
+    }
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int> v1(3);
+        std::list<int> v2(3);
+        int i = 4;
+        v1.insert(v2.begin(), i);
+        assert(false);
+    }
+#endif
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3};
+    int a2[] = {1, 4, 2, 3};
+    std::list<int, min_allocator<int>> l1(a1, a1+3);
+    std::list<int, min_allocator<int>>::iterator i = l1.insert(next(l1.cbegin()), 4);
+    assert(i == next(l1.begin()));
+    assert(l1.size() == 4);
+    assert(distance(l1.begin(), l1.end()) == 4);
+    assert((l1 == std::list<int, min_allocator<int>>(a2, a2+4)));
+    throw_next = 0;
+    int save_count = count;
+    try
+    {
+        i = l1.insert(i, 5);
+        assert(false);
+    }
+    catch (...)
+    {
+    }
+    throw_next = 0xFFFF;
+    assert(save_count == count);
+    assert((l1 == std::list<int, min_allocator<int>>(a2, a2+4)));
+    }
+#if _LIBCPP_DEBUG >= 1
+    {
+        std::list<int, min_allocator<int>> v1(3);
+        std::list<int, min_allocator<int>> v2(3);
+        int i = 4;
+        v1.insert(v2.begin(), i);
+        assert(false);
+    }
+#endif
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void pop_back();
+
+#if _LIBCPP_DEBUG >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a[] = {1, 2, 3};
+    std::list<int> c(a, a+3);
+    c.pop_back();
+    assert(c == std::list<int>(a, a+2));
+    c.pop_back();
+    assert(c == std::list<int>(a, a+1));
+    c.pop_back();
+    assert(c.empty());
+#if _LIBCPP_DEBUG >= 1
+        c.pop_back();
+        assert(false);
+#endif        
+    }
+#if __cplusplus >= 201103L
+    {
+    int a[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> c(a, a+3);
+    c.pop_back();
+    assert((c == std::list<int, min_allocator<int>>(a, a+2)));
+    c.pop_back();
+    assert((c == std::list<int, min_allocator<int>>(a, a+1)));
+    c.pop_back();
+    assert(c.empty());
+#if _LIBCPP_DEBUG >= 1
+        c.pop_back();
+        assert(false);
+#endif        
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void pop_front();
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a[] = {1, 2, 3};
+    std::list<int> c(a, a+3);
+    c.pop_front();
+    assert(c == std::list<int>(a+1, a+3));
+    c.pop_front();
+    assert(c == std::list<int>(a+2, a+3));
+    c.pop_front();
+    assert(c.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+    int a[] = {1, 2, 3};
+    std::list<int, min_allocator<int>> c(a, a+3);
+    c.pop_front();
+    assert((c == std::list<int, min_allocator<int>>(a+1, a+3)));
+    c.pop_front();
+    assert((c == std::list<int, min_allocator<int>>(a+2, a+3)));
+    c.pop_front();
+    assert(c.empty());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void push_back(const value_type& x);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    std::list<int> c;
+    for (int i = 0; i < 5; ++i)
+        c.push_back(i);
+    int a[] = {0, 1, 2, 3, 4};
+    assert(c == std::list<int>(a, a+5));
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<int, min_allocator<int>> c;
+    for (int i = 0; i < 5; ++i)
+        c.push_back(i);
+    int a[] = {0, 1, 2, 3, 4};
+    assert((c == std::list<int, min_allocator<int>>(a, a+5)));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void push_back(const value_type& x);
+
+#include <list>
+#include <cassert>
+
+// Flag that makes the copy constructor for CMyClass throw an exception
+static bool gCopyConstructorShouldThow = false;
+
+
+class CMyClass {
+    public: CMyClass();
+    public: CMyClass(const CMyClass& iOther);
+    public: ~CMyClass();
+
+    private: int fMagicValue;
+
+    private: static int kStartedConstructionMagicValue;
+    private: static int kFinishedConstructionMagicValue;
+};
+
+// Value for fMagicValue when the constructor has started running, but not yet finished
+int CMyClass::kStartedConstructionMagicValue = 0;
+// Value for fMagicValue when the constructor has finished running
+int CMyClass::kFinishedConstructionMagicValue = 12345;
+
+CMyClass::CMyClass() :
+    fMagicValue(kStartedConstructionMagicValue)
+{
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::CMyClass(const CMyClass& /*iOther*/) :
+    fMagicValue(kStartedConstructionMagicValue)
+{
+    // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+    if (gCopyConstructorShouldThow) {
+        throw std::exception();
+    }
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::~CMyClass() {
+    // Only instances for which the constructor has finished running should be destructed
+    assert(fMagicValue == kFinishedConstructionMagicValue);
+}
+
+int main()
+{
+    CMyClass instance;
+    std::list<CMyClass> vec;
+
+    vec.push_back(instance);
+
+    gCopyConstructorShouldThow = true;
+    try {
+        vec.push_back(instance);
+    }
+    catch (...) {
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void push_back(value_type&& x);
+
+#include <list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<MoveOnly> l1;
+    l1.push_back(MoveOnly(1));
+    assert(l1.size() == 1);
+    assert(l1.front() == MoveOnly(1));
+    l1.push_back(MoveOnly(2));
+    assert(l1.size() == 2);
+    assert(l1.front() == MoveOnly(1));
+    assert(l1.back() == MoveOnly(2));
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<MoveOnly, min_allocator<MoveOnly>> l1;
+    l1.push_back(MoveOnly(1));
+    assert(l1.size() == 1);
+    assert(l1.front() == MoveOnly(1));
+    l1.push_back(MoveOnly(2));
+    assert(l1.size() == 2);
+    assert(l1.front() == MoveOnly(1));
+    assert(l1.back() == MoveOnly(2));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void push_front(const value_type& x);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    std::list<int> c;
+    for (int i = 0; i < 5; ++i)
+        c.push_front(i);
+    int a[] = {4, 3, 2, 1, 0};
+    assert(c == std::list<int>(a, a+5));
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<int, min_allocator<int>> c;
+    for (int i = 0; i < 5; ++i)
+        c.push_front(i);
+    int a[] = {4, 3, 2, 1, 0};
+    assert((c == std::list<int, min_allocator<int>>(a, a+5)));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void push_front(const value_type& x);
+
+#include <list>
+#include <cassert>
+
+// Flag that makes the copy constructor for CMyClass throw an exception
+static bool gCopyConstructorShouldThow = false;
+
+
+class CMyClass {
+    public: CMyClass();
+    public: CMyClass(const CMyClass& iOther);
+    public: ~CMyClass();
+
+    private: int fMagicValue;
+
+    private: static int kStartedConstructionMagicValue;
+    private: static int kFinishedConstructionMagicValue;
+};
+
+// Value for fMagicValue when the constructor has started running, but not yet finished
+int CMyClass::kStartedConstructionMagicValue = 0;
+// Value for fMagicValue when the constructor has finished running
+int CMyClass::kFinishedConstructionMagicValue = 12345;
+
+CMyClass::CMyClass() :
+    fMagicValue(kStartedConstructionMagicValue)
+{
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::CMyClass(const CMyClass& /*iOther*/) :
+    fMagicValue(kStartedConstructionMagicValue)
+{
+    // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
+    if (gCopyConstructorShouldThow) {
+        throw std::exception();
+    }
+    // Signal that the constructor has finished running
+    fMagicValue = kFinishedConstructionMagicValue;
+}
+
+CMyClass::~CMyClass() {
+    // Only instances for which the constructor has finished running should be destructed
+    assert(fMagicValue == kFinishedConstructionMagicValue);
+}
+
+int main()
+{
+    CMyClass instance;
+    std::list<CMyClass> vec;
+
+    vec.push_front(instance);
+
+    gCopyConstructorShouldThow = true;
+    try {
+        vec.push_front(instance);
+    }
+    catch (...) {
+    }
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void push_front(value_type&& x);
+
+#include <list>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::list<MoveOnly> l1;
+    l1.push_front(MoveOnly(1));
+    assert(l1.size() == 1);
+    assert(l1.front() == MoveOnly(1));
+    l1.push_front(MoveOnly(2));
+    assert(l1.size() == 2);
+    assert(l1.front() == MoveOnly(2));
+    assert(l1.back() == MoveOnly(1));
+    }
+#if __cplusplus >= 201103L
+    {
+    std::list<MoveOnly, min_allocator<MoveOnly>> l1;
+    l1.push_front(MoveOnly(1));
+    assert(l1.size() == 1);
+    assert(l1.front() == MoveOnly(1));
+    l1.push_front(MoveOnly(2));
+    assert(l1.size() == 2);
+    assert(l1.front() == MoveOnly(2));
+    assert(l1.back() == MoveOnly(1));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void merge(list& x);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {1, 3, 7, 9, 10};
+    int a2[] = {0, 2, 4, 5, 6, 8, 11};
+    int a3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+    c1.merge(c2);
+    assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 3, 7, 9, 10};
+    int a2[] = {0, 2, 4, 5, 6, 8, 11};
+    int a3[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+    std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+    c1.merge(c2);
+    assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class Compare> void merge(list& x, Compare comp);
+
+#include <list>
+#include <functional>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {10, 9, 7, 3, 1};
+    int a2[] = {11, 8, 6, 5, 4, 2, 0};
+    int a3[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+    c1.merge(c2, std::greater<int>());
+    assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {10, 9, 7, 3, 1};
+    int a2[] = {11, 8, 6, 5, 4, 2, 0};
+    int a3[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+    std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+    c1.merge(c2, std::greater<int>());
+    assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.ops/remove.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/remove.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/remove.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/remove.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void remove(const value_type& value);
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+struct S {
+    S(int i) : i_(new int(i)) {}
+    S(const S &rhs) : i_(new int(*rhs.i_)) {}
+    S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
+    ~S () { delete i_; i_ = NULL; }
+    bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
+    int get () const { return *i_; }
+    int *i_;
+    };
+
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3, 4};
+    int a2[] = {1, 2, 4};
+    std::list<int> c(a1, a1+4);
+    c.remove(3);
+    assert(c == std::list<int>(a2, a2+3));
+    }
+    {  // LWG issue #526
+    int a1[] = {1, 2, 1, 3, 5, 8, 11};
+    int a2[] = {   2,    3, 5, 8, 11};
+    std::list<int> c(a1, a1+7);
+    c.remove(c.front());
+    assert(c == std::list<int>(a2, a2+5));
+    }
+    {
+    int a1[] = {1, 2, 1, 3, 5, 8, 11, 1};
+    int a2[] = {   2,    3, 5, 8, 11   };
+    std::list<S> c;
+    for(int *ip = a1; ip < a1+8; ++ip)
+        c.push_back(S(*ip));
+    c.remove(c.front());
+    std::list<S>::const_iterator it = c.begin();
+    for(int *ip = a2; ip < a2+5; ++ip, ++it) {
+        assert ( it != c.end());
+        assert ( *ip == it->get());
+        }
+    assert ( it == c.end ());
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3, 4};
+    int a2[] = {1, 2, 4};
+    std::list<int, min_allocator<int>> c(a1, a1+4);
+    c.remove(3);
+    assert((c == std::list<int, min_allocator<int>>(a2, a2+3)));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/remove_if.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class Pred> void remove_if(Pred pred);
+
+#include <list>
+#include <cassert>
+#include <functional>
+
+#include "min_allocator.h"
+#include "counting_predicates.hpp"
+
+bool even(int i)
+{
+    return i % 2 == 0;
+}
+
+bool g(int i)
+{
+    return i < 3;
+}
+
+typedef unary_counting_predicate<bool(*)(int), int> Predicate;
+
+int main()
+{
+    {
+    int a1[] = {1, 2, 3, 4};
+    int a2[] = {3, 4};
+    std::list<int> c(a1, a1+4);
+    Predicate cp(g);
+    c.remove_if(std::ref(cp));
+    assert(c == std::list<int>(a2, a2+2));
+    assert(cp.count() == 4);
+    }
+    {
+    int a1[] = {1, 2, 3, 4};
+    int a2[] = {1, 3};
+    std::list<int> c(a1, a1+4);
+    Predicate cp(even);
+    c.remove_if(std::ref(cp));
+    assert(c == std::list<int>(a2, a2+2));
+    assert(cp.count() == 4);
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {1, 2, 3, 4};
+    int a2[] = {3, 4};
+    std::list<int, min_allocator<int>> c(a1, a1+4);
+    Predicate cp(g);
+    c.remove_if(std::ref(cp));
+    assert((c == std::list<int, min_allocator<int>>(a2, a2+2)));
+    assert(cp.count() == 4);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.ops/reverse.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/reverse.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/reverse.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/reverse.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void reverse();
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+    int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.reverse();
+    assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+    int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+    std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.reverse();
+    assert((c1 == std::list<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.ops/sort.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/sort.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/sort.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/sort.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// void sort();
+
+#include <list>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
+    int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.sort();
+    assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
+    int a2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+    std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.sort();
+    assert((c1 == std::list<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/sort_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// template <class Compare> sort(Compare comp);
+
+#include <list>
+#include <functional>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
+    int a2[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.sort(std::greater<int>());
+    assert(c1 == std::list<int>(a2, a2+sizeof(a2)/sizeof(a2[0])));
+    }
+#if __cplusplus >= 201103L
+    {
+    int a1[] = {4, 8, 1, 0, 5, 7, 2, 3, 6, 11, 10, 9};
+    int a2[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+    std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.sort(std::greater<int>());
+    assert((c1 == std::list<int, min_allocator<int>>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
+    }
+#endif
+}





More information about the cfe-commits mailing list