[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/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/is.heap/is_heap_until_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,522 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires CopyConstructible<Compare>
+//   Iter
+//   is_heap_until(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+void test()
+{
+    int i1[] = {0, 0};
+    assert(std::is_heap_until(i1, i1, std::greater<int>()) == i1);
+    assert(std::is_heap_until(i1, i1+1, std::greater<int>()) == i1+1);
+    int i2[] = {0, 1};
+    int i3[] = {1, 0};
+    assert(std::is_heap_until(i1, i1+2, std::greater<int>()) == i1+2);
+    assert(std::is_heap_until(i2, i2+2, std::greater<int>()) == i2+2);
+    assert(std::is_heap_until(i3, i3+2, std::greater<int>()) == i3+1);
+    int i4[] = {0, 0, 0};
+    int i5[] = {0, 0, 1};
+    int i6[] = {0, 1, 0};
+    int i7[] = {0, 1, 1};
+    int i8[] = {1, 0, 0};
+    int i9[] = {1, 0, 1};
+    int i10[] = {1, 1, 0};
+    assert(std::is_heap_until(i4, i4+3, std::greater<int>()) == i4+3);
+    assert(std::is_heap_until(i5, i5+3, std::greater<int>()) == i5+3);
+    assert(std::is_heap_until(i6, i6+3, std::greater<int>()) == i6+3);
+    assert(std::is_heap_until(i7, i7+3, std::greater<int>()) == i7+3);
+    assert(std::is_heap_until(i8, i8+3, std::greater<int>()) == i8+1);
+    assert(std::is_heap_until(i9, i9+3, std::greater<int>()) == i9+1);
+    assert(std::is_heap_until(i10, i10+3, std::greater<int>()) == i10+2);
+    int i11[] = {0, 0, 0, 0};
+    int i12[] = {0, 0, 0, 1};
+    int i13[] = {0, 0, 1, 0};
+    int i14[] = {0, 0, 1, 1};
+    int i15[] = {0, 1, 0, 0};
+    int i16[] = {0, 1, 0, 1};
+    int i17[] = {0, 1, 1, 0};
+    int i18[] = {0, 1, 1, 1};
+    int i19[] = {1, 0, 0, 0};
+    int i20[] = {1, 0, 0, 1};
+    int i21[] = {1, 0, 1, 0};
+    int i22[] = {1, 0, 1, 1};
+    int i23[] = {1, 1, 0, 0};
+    int i24[] = {1, 1, 0, 1};
+    int i25[] = {1, 1, 1, 0};
+    assert(std::is_heap_until(i11, i11+4, std::greater<int>()) == i11+4);
+    assert(std::is_heap_until(i12, i12+4, std::greater<int>()) == i12+4);
+    assert(std::is_heap_until(i13, i13+4, std::greater<int>()) == i13+4);
+    assert(std::is_heap_until(i14, i14+4, std::greater<int>()) == i14+4);
+    assert(std::is_heap_until(i15, i15+4, std::greater<int>()) == i15+3);
+    assert(std::is_heap_until(i16, i16+4, std::greater<int>()) == i16+4);
+    assert(std::is_heap_until(i17, i17+4, std::greater<int>()) == i17+3);
+    assert(std::is_heap_until(i18, i18+4, std::greater<int>()) == i18+4);
+    assert(std::is_heap_until(i19, i19+4, std::greater<int>()) == i19+1);
+    assert(std::is_heap_until(i20, i20+4, std::greater<int>()) == i20+1);
+    assert(std::is_heap_until(i21, i21+4, std::greater<int>()) == i21+1);
+    assert(std::is_heap_until(i22, i22+4, std::greater<int>()) == i22+1);
+    assert(std::is_heap_until(i23, i23+4, std::greater<int>()) == i23+2);
+    assert(std::is_heap_until(i24, i24+4, std::greater<int>()) == i24+2);
+    assert(std::is_heap_until(i25, i25+4, std::greater<int>()) == i25+3);
+    int i26[] = {0, 0, 0, 0, 0};
+    int i27[] = {0, 0, 0, 0, 1};
+    int i28[] = {0, 0, 0, 1, 0};
+    int i29[] = {0, 0, 0, 1, 1};
+    int i30[] = {0, 0, 1, 0, 0};
+    int i31[] = {0, 0, 1, 0, 1};
+    int i32[] = {0, 0, 1, 1, 0};
+    int i33[] = {0, 0, 1, 1, 1};
+    int i34[] = {0, 1, 0, 0, 0};
+    int i35[] = {0, 1, 0, 0, 1};
+    int i36[] = {0, 1, 0, 1, 0};
+    int i37[] = {0, 1, 0, 1, 1};
+    int i38[] = {0, 1, 1, 0, 0};
+    int i39[] = {0, 1, 1, 0, 1};
+    int i40[] = {0, 1, 1, 1, 0};
+    int i41[] = {0, 1, 1, 1, 1};
+    int i42[] = {1, 0, 0, 0, 0};
+    int i43[] = {1, 0, 0, 0, 1};
+    int i44[] = {1, 0, 0, 1, 0};
+    int i45[] = {1, 0, 0, 1, 1};
+    int i46[] = {1, 0, 1, 0, 0};
+    int i47[] = {1, 0, 1, 0, 1};
+    int i48[] = {1, 0, 1, 1, 0};
+    int i49[] = {1, 0, 1, 1, 1};
+    int i50[] = {1, 1, 0, 0, 0};
+    int i51[] = {1, 1, 0, 0, 1};
+    int i52[] = {1, 1, 0, 1, 0};
+    int i53[] = {1, 1, 0, 1, 1};
+    int i54[] = {1, 1, 1, 0, 0};
+    int i55[] = {1, 1, 1, 0, 1};
+    int i56[] = {1, 1, 1, 1, 0};
+    assert(std::is_heap_until(i26, i26+5, std::greater<int>()) == i26+5);
+    assert(std::is_heap_until(i27, i27+5, std::greater<int>()) == i27+5);
+    assert(std::is_heap_until(i28, i28+5, std::greater<int>()) == i28+5);
+    assert(std::is_heap_until(i29, i29+5, std::greater<int>()) == i29+5);
+    assert(std::is_heap_until(i30, i30+5, std::greater<int>()) == i30+5);
+    assert(std::is_heap_until(i31, i31+5, std::greater<int>()) == i31+5);
+    assert(std::is_heap_until(i32, i32+5, std::greater<int>()) == i32+5);
+    assert(std::is_heap_until(i33, i33+5, std::greater<int>()) == i33+5);
+    assert(std::is_heap_until(i34, i34+5, std::greater<int>()) == i34+3);
+    assert(std::is_heap_until(i35, i35+5, std::greater<int>()) == i35+3);
+    assert(std::is_heap_until(i36, i36+5, std::greater<int>()) == i36+4);
+    assert(std::is_heap_until(i37, i37+5, std::greater<int>()) == i37+5);
+    assert(std::is_heap_until(i38, i38+5, std::greater<int>()) == i38+3);
+    assert(std::is_heap_until(i39, i39+5, std::greater<int>()) == i39+3);
+    assert(std::is_heap_until(i40, i40+5, std::greater<int>()) == i40+4);
+    assert(std::is_heap_until(i41, i41+5, std::greater<int>()) == i41+5);
+    assert(std::is_heap_until(i42, i42+5, std::greater<int>()) == i42+1);
+    assert(std::is_heap_until(i43, i43+5, std::greater<int>()) == i43+1);
+    assert(std::is_heap_until(i44, i44+5, std::greater<int>()) == i44+1);
+    assert(std::is_heap_until(i45, i45+5, std::greater<int>()) == i45+1);
+    assert(std::is_heap_until(i46, i46+5, std::greater<int>()) == i46+1);
+    assert(std::is_heap_until(i47, i47+5, std::greater<int>()) == i47+1);
+    assert(std::is_heap_until(i48, i48+5, std::greater<int>()) == i48+1);
+    assert(std::is_heap_until(i49, i49+5, std::greater<int>()) == i49+1);
+    assert(std::is_heap_until(i50, i50+5, std::greater<int>()) == i50+2);
+    assert(std::is_heap_until(i51, i51+5, std::greater<int>()) == i51+2);
+    assert(std::is_heap_until(i52, i52+5, std::greater<int>()) == i52+2);
+    assert(std::is_heap_until(i53, i53+5, std::greater<int>()) == i53+2);
+    assert(std::is_heap_until(i54, i54+5, std::greater<int>()) == i54+3);
+    assert(std::is_heap_until(i55, i55+5, std::greater<int>()) == i55+3);
+    assert(std::is_heap_until(i56, i56+5, std::greater<int>()) == i56+4);
+    int i57[] = {0, 0, 0, 0, 0, 0};
+    int i58[] = {0, 0, 0, 0, 0, 1};
+    int i59[] = {0, 0, 0, 0, 1, 0};
+    int i60[] = {0, 0, 0, 0, 1, 1};
+    int i61[] = {0, 0, 0, 1, 0, 0};
+    int i62[] = {0, 0, 0, 1, 0, 1};
+    int i63[] = {0, 0, 0, 1, 1, 0};
+    int i64[] = {0, 0, 0, 1, 1, 1};
+    int i65[] = {0, 0, 1, 0, 0, 0};
+    int i66[] = {0, 0, 1, 0, 0, 1};
+    int i67[] = {0, 0, 1, 0, 1, 0};
+    int i68[] = {0, 0, 1, 0, 1, 1};
+    int i69[] = {0, 0, 1, 1, 0, 0};
+    int i70[] = {0, 0, 1, 1, 0, 1};
+    int i71[] = {0, 0, 1, 1, 1, 0};
+    int i72[] = {0, 0, 1, 1, 1, 1};
+    int i73[] = {0, 1, 0, 0, 0, 0};
+    int i74[] = {0, 1, 0, 0, 0, 1};
+    int i75[] = {0, 1, 0, 0, 1, 0};
+    int i76[] = {0, 1, 0, 0, 1, 1};
+    int i77[] = {0, 1, 0, 1, 0, 0};
+    int i78[] = {0, 1, 0, 1, 0, 1};
+    int i79[] = {0, 1, 0, 1, 1, 0};
+    int i80[] = {0, 1, 0, 1, 1, 1};
+    int i81[] = {0, 1, 1, 0, 0, 0};
+    int i82[] = {0, 1, 1, 0, 0, 1};
+    int i83[] = {0, 1, 1, 0, 1, 0};
+    int i84[] = {0, 1, 1, 0, 1, 1};
+    int i85[] = {0, 1, 1, 1, 0, 0};
+    int i86[] = {0, 1, 1, 1, 0, 1};
+    int i87[] = {0, 1, 1, 1, 1, 0};
+    int i88[] = {0, 1, 1, 1, 1, 1};
+    int i89[] = {1, 0, 0, 0, 0, 0};
+    int i90[] = {1, 0, 0, 0, 0, 1};
+    int i91[] = {1, 0, 0, 0, 1, 0};
+    int i92[] = {1, 0, 0, 0, 1, 1};
+    int i93[] = {1, 0, 0, 1, 0, 0};
+    int i94[] = {1, 0, 0, 1, 0, 1};
+    int i95[] = {1, 0, 0, 1, 1, 0};
+    int i96[] = {1, 0, 0, 1, 1, 1};
+    int i97[] = {1, 0, 1, 0, 0, 0};
+    int i98[] = {1, 0, 1, 0, 0, 1};
+    int i99[] = {1, 0, 1, 0, 1, 0};
+    int i100[] = {1, 0, 1, 0, 1, 1};
+    int i101[] = {1, 0, 1, 1, 0, 0};
+    int i102[] = {1, 0, 1, 1, 0, 1};
+    int i103[] = {1, 0, 1, 1, 1, 0};
+    int i104[] = {1, 0, 1, 1, 1, 1};
+    int i105[] = {1, 1, 0, 0, 0, 0};
+    int i106[] = {1, 1, 0, 0, 0, 1};
+    int i107[] = {1, 1, 0, 0, 1, 0};
+    int i108[] = {1, 1, 0, 0, 1, 1};
+    int i109[] = {1, 1, 0, 1, 0, 0};
+    int i110[] = {1, 1, 0, 1, 0, 1};
+    int i111[] = {1, 1, 0, 1, 1, 0};
+    int i112[] = {1, 1, 0, 1, 1, 1};
+    int i113[] = {1, 1, 1, 0, 0, 0};
+    int i114[] = {1, 1, 1, 0, 0, 1};
+    int i115[] = {1, 1, 1, 0, 1, 0};
+    int i116[] = {1, 1, 1, 0, 1, 1};
+    int i117[] = {1, 1, 1, 1, 0, 0};
+    int i118[] = {1, 1, 1, 1, 0, 1};
+    int i119[] = {1, 1, 1, 1, 1, 0};
+    assert(std::is_heap_until(i57, i57+6, std::greater<int>()) == i57+6);
+    assert(std::is_heap_until(i58, i58+6, std::greater<int>()) == i58+6);
+    assert(std::is_heap_until(i59, i59+6, std::greater<int>()) == i59+6);
+    assert(std::is_heap_until(i60, i60+6, std::greater<int>()) == i60+6);
+    assert(std::is_heap_until(i61, i61+6, std::greater<int>()) == i61+6);
+    assert(std::is_heap_until(i62, i62+6, std::greater<int>()) == i62+6);
+    assert(std::is_heap_until(i63, i63+6, std::greater<int>()) == i63+6);
+    assert(std::is_heap_until(i64, i64+6, std::greater<int>()) == i64+6);
+    assert(std::is_heap_until(i65, i65+6, std::greater<int>()) == i65+5);
+    assert(std::is_heap_until(i66, i66+6, std::greater<int>()) == i66+6);
+    assert(std::is_heap_until(i67, i67+6, std::greater<int>()) == i67+5);
+    assert(std::is_heap_until(i68, i68+6, std::greater<int>()) == i68+6);
+    assert(std::is_heap_until(i69, i69+6, std::greater<int>()) == i69+5);
+    assert(std::is_heap_until(i70, i70+6, std::greater<int>()) == i70+6);
+    assert(std::is_heap_until(i71, i71+6, std::greater<int>()) == i71+5);
+    assert(std::is_heap_until(i72, i72+6, std::greater<int>()) == i72+6);
+    assert(std::is_heap_until(i73, i73+6, std::greater<int>()) == i73+3);
+    assert(std::is_heap_until(i74, i74+6, std::greater<int>()) == i74+3);
+    assert(std::is_heap_until(i75, i75+6, std::greater<int>()) == i75+3);
+    assert(std::is_heap_until(i76, i76+6, std::greater<int>()) == i76+3);
+    assert(std::is_heap_until(i77, i77+6, std::greater<int>()) == i77+4);
+    assert(std::is_heap_until(i78, i78+6, std::greater<int>()) == i78+4);
+    assert(std::is_heap_until(i79, i79+6, std::greater<int>()) == i79+6);
+    assert(std::is_heap_until(i80, i80+6, std::greater<int>()) == i80+6);
+    assert(std::is_heap_until(i81, i81+6, std::greater<int>()) == i81+3);
+    assert(std::is_heap_until(i82, i82+6, std::greater<int>()) == i82+3);
+    assert(std::is_heap_until(i83, i83+6, std::greater<int>()) == i83+3);
+    assert(std::is_heap_until(i84, i84+6, std::greater<int>()) == i84+3);
+    assert(std::is_heap_until(i85, i85+6, std::greater<int>()) == i85+4);
+    assert(std::is_heap_until(i86, i86+6, std::greater<int>()) == i86+4);
+    assert(std::is_heap_until(i87, i87+6, std::greater<int>()) == i87+5);
+    assert(std::is_heap_until(i88, i88+6, std::greater<int>()) == i88+6);
+    assert(std::is_heap_until(i89, i89+6, std::greater<int>()) == i89+1);
+    assert(std::is_heap_until(i90, i90+6, std::greater<int>()) == i90+1);
+    assert(std::is_heap_until(i91, i91+6, std::greater<int>()) == i91+1);
+    assert(std::is_heap_until(i92, i92+6, std::greater<int>()) == i92+1);
+    assert(std::is_heap_until(i93, i93+6, std::greater<int>()) == i93+1);
+    assert(std::is_heap_until(i94, i94+6, std::greater<int>()) == i94+1);
+    assert(std::is_heap_until(i95, i95+6, std::greater<int>()) == i95+1);
+    assert(std::is_heap_until(i96, i96+6, std::greater<int>()) == i96+1);
+    assert(std::is_heap_until(i97, i97+6, std::greater<int>()) == i97+1);
+    assert(std::is_heap_until(i98, i98+6, std::greater<int>()) == i98+1);
+    assert(std::is_heap_until(i99, i99+6, std::greater<int>()) == i99+1);
+    assert(std::is_heap_until(i100, i100+6, std::greater<int>()) == i100+1);
+    assert(std::is_heap_until(i101, i101+6, std::greater<int>()) == i101+1);
+    assert(std::is_heap_until(i102, i102+6, std::greater<int>()) == i102+1);
+    assert(std::is_heap_until(i103, i103+6, std::greater<int>()) == i103+1);
+    assert(std::is_heap_until(i104, i104+6, std::greater<int>()) == i104+1);
+    assert(std::is_heap_until(i105, i105+6, std::greater<int>()) == i105+2);
+    assert(std::is_heap_until(i106, i106+6, std::greater<int>()) == i106+2);
+    assert(std::is_heap_until(i107, i107+6, std::greater<int>()) == i107+2);
+    assert(std::is_heap_until(i108, i108+6, std::greater<int>()) == i108+2);
+    assert(std::is_heap_until(i109, i109+6, std::greater<int>()) == i109+2);
+    assert(std::is_heap_until(i110, i110+6, std::greater<int>()) == i110+2);
+    assert(std::is_heap_until(i111, i111+6, std::greater<int>()) == i111+2);
+    assert(std::is_heap_until(i112, i112+6, std::greater<int>()) == i112+2);
+    assert(std::is_heap_until(i113, i113+6, std::greater<int>()) == i113+3);
+    assert(std::is_heap_until(i114, i114+6, std::greater<int>()) == i114+3);
+    assert(std::is_heap_until(i115, i115+6, std::greater<int>()) == i115+3);
+    assert(std::is_heap_until(i116, i116+6, std::greater<int>()) == i116+3);
+    assert(std::is_heap_until(i117, i117+6, std::greater<int>()) == i117+4);
+    assert(std::is_heap_until(i118, i118+6, std::greater<int>()) == i118+4);
+    assert(std::is_heap_until(i119, i119+6, std::greater<int>()) == i119+5);
+    int i120[] = {0, 0, 0, 0, 0, 0, 0};
+    int i121[] = {0, 0, 0, 0, 0, 0, 1};
+    int i122[] = {0, 0, 0, 0, 0, 1, 0};
+    int i123[] = {0, 0, 0, 0, 0, 1, 1};
+    int i124[] = {0, 0, 0, 0, 1, 0, 0};
+    int i125[] = {0, 0, 0, 0, 1, 0, 1};
+    int i126[] = {0, 0, 0, 0, 1, 1, 0};
+    int i127[] = {0, 0, 0, 0, 1, 1, 1};
+    int i128[] = {0, 0, 0, 1, 0, 0, 0};
+    int i129[] = {0, 0, 0, 1, 0, 0, 1};
+    int i130[] = {0, 0, 0, 1, 0, 1, 0};
+    int i131[] = {0, 0, 0, 1, 0, 1, 1};
+    int i132[] = {0, 0, 0, 1, 1, 0, 0};
+    int i133[] = {0, 0, 0, 1, 1, 0, 1};
+    int i134[] = {0, 0, 0, 1, 1, 1, 0};
+    int i135[] = {0, 0, 0, 1, 1, 1, 1};
+    int i136[] = {0, 0, 1, 0, 0, 0, 0};
+    int i137[] = {0, 0, 1, 0, 0, 0, 1};
+    int i138[] = {0, 0, 1, 0, 0, 1, 0};
+    int i139[] = {0, 0, 1, 0, 0, 1, 1};
+    int i140[] = {0, 0, 1, 0, 1, 0, 0};
+    int i141[] = {0, 0, 1, 0, 1, 0, 1};
+    int i142[] = {0, 0, 1, 0, 1, 1, 0};
+    int i143[] = {0, 0, 1, 0, 1, 1, 1};
+    int i144[] = {0, 0, 1, 1, 0, 0, 0};
+    int i145[] = {0, 0, 1, 1, 0, 0, 1};
+    int i146[] = {0, 0, 1, 1, 0, 1, 0};
+    int i147[] = {0, 0, 1, 1, 0, 1, 1};
+    int i148[] = {0, 0, 1, 1, 1, 0, 0};
+    int i149[] = {0, 0, 1, 1, 1, 0, 1};
+    int i150[] = {0, 0, 1, 1, 1, 1, 0};
+    int i151[] = {0, 0, 1, 1, 1, 1, 1};
+    int i152[] = {0, 1, 0, 0, 0, 0, 0};
+    int i153[] = {0, 1, 0, 0, 0, 0, 1};
+    int i154[] = {0, 1, 0, 0, 0, 1, 0};
+    int i155[] = {0, 1, 0, 0, 0, 1, 1};
+    int i156[] = {0, 1, 0, 0, 1, 0, 0};
+    int i157[] = {0, 1, 0, 0, 1, 0, 1};
+    int i158[] = {0, 1, 0, 0, 1, 1, 0};
+    int i159[] = {0, 1, 0, 0, 1, 1, 1};
+    int i160[] = {0, 1, 0, 1, 0, 0, 0};
+    int i161[] = {0, 1, 0, 1, 0, 0, 1};
+    int i162[] = {0, 1, 0, 1, 0, 1, 0};
+    int i163[] = {0, 1, 0, 1, 0, 1, 1};
+    int i164[] = {0, 1, 0, 1, 1, 0, 0};
+    int i165[] = {0, 1, 0, 1, 1, 0, 1};
+    int i166[] = {0, 1, 0, 1, 1, 1, 0};
+    int i167[] = {0, 1, 0, 1, 1, 1, 1};
+    int i168[] = {0, 1, 1, 0, 0, 0, 0};
+    int i169[] = {0, 1, 1, 0, 0, 0, 1};
+    int i170[] = {0, 1, 1, 0, 0, 1, 0};
+    int i171[] = {0, 1, 1, 0, 0, 1, 1};
+    int i172[] = {0, 1, 1, 0, 1, 0, 0};
+    int i173[] = {0, 1, 1, 0, 1, 0, 1};
+    int i174[] = {0, 1, 1, 0, 1, 1, 0};
+    int i175[] = {0, 1, 1, 0, 1, 1, 1};
+    int i176[] = {0, 1, 1, 1, 0, 0, 0};
+    int i177[] = {0, 1, 1, 1, 0, 0, 1};
+    int i178[] = {0, 1, 1, 1, 0, 1, 0};
+    int i179[] = {0, 1, 1, 1, 0, 1, 1};
+    int i180[] = {0, 1, 1, 1, 1, 0, 0};
+    int i181[] = {0, 1, 1, 1, 1, 0, 1};
+    int i182[] = {0, 1, 1, 1, 1, 1, 0};
+    int i183[] = {0, 1, 1, 1, 1, 1, 1};
+    int i184[] = {1, 0, 0, 0, 0, 0, 0};
+    int i185[] = {1, 0, 0, 0, 0, 0, 1};
+    int i186[] = {1, 0, 0, 0, 0, 1, 0};
+    int i187[] = {1, 0, 0, 0, 0, 1, 1};
+    int i188[] = {1, 0, 0, 0, 1, 0, 0};
+    int i189[] = {1, 0, 0, 0, 1, 0, 1};
+    int i190[] = {1, 0, 0, 0, 1, 1, 0};
+    int i191[] = {1, 0, 0, 0, 1, 1, 1};
+    int i192[] = {1, 0, 0, 1, 0, 0, 0};
+    int i193[] = {1, 0, 0, 1, 0, 0, 1};
+    int i194[] = {1, 0, 0, 1, 0, 1, 0};
+    int i195[] = {1, 0, 0, 1, 0, 1, 1};
+    int i196[] = {1, 0, 0, 1, 1, 0, 0};
+    int i197[] = {1, 0, 0, 1, 1, 0, 1};
+    int i198[] = {1, 0, 0, 1, 1, 1, 0};
+    int i199[] = {1, 0, 0, 1, 1, 1, 1};
+    int i200[] = {1, 0, 1, 0, 0, 0, 0};
+    int i201[] = {1, 0, 1, 0, 0, 0, 1};
+    int i202[] = {1, 0, 1, 0, 0, 1, 0};
+    int i203[] = {1, 0, 1, 0, 0, 1, 1};
+    int i204[] = {1, 0, 1, 0, 1, 0, 0};
+    int i205[] = {1, 0, 1, 0, 1, 0, 1};
+    int i206[] = {1, 0, 1, 0, 1, 1, 0};
+    int i207[] = {1, 0, 1, 0, 1, 1, 1};
+    int i208[] = {1, 0, 1, 1, 0, 0, 0};
+    int i209[] = {1, 0, 1, 1, 0, 0, 1};
+    int i210[] = {1, 0, 1, 1, 0, 1, 0};
+    int i211[] = {1, 0, 1, 1, 0, 1, 1};
+    int i212[] = {1, 0, 1, 1, 1, 0, 0};
+    int i213[] = {1, 0, 1, 1, 1, 0, 1};
+    int i214[] = {1, 0, 1, 1, 1, 1, 0};
+    int i215[] = {1, 0, 1, 1, 1, 1, 1};
+    int i216[] = {1, 1, 0, 0, 0, 0, 0};
+    int i217[] = {1, 1, 0, 0, 0, 0, 1};
+    int i218[] = {1, 1, 0, 0, 0, 1, 0};
+    int i219[] = {1, 1, 0, 0, 0, 1, 1};
+    int i220[] = {1, 1, 0, 0, 1, 0, 0};
+    int i221[] = {1, 1, 0, 0, 1, 0, 1};
+    int i222[] = {1, 1, 0, 0, 1, 1, 0};
+    int i223[] = {1, 1, 0, 0, 1, 1, 1};
+    int i224[] = {1, 1, 0, 1, 0, 0, 0};
+    int i225[] = {1, 1, 0, 1, 0, 0, 1};
+    int i226[] = {1, 1, 0, 1, 0, 1, 0};
+    int i227[] = {1, 1, 0, 1, 0, 1, 1};
+    int i228[] = {1, 1, 0, 1, 1, 0, 0};
+    int i229[] = {1, 1, 0, 1, 1, 0, 1};
+    int i230[] = {1, 1, 0, 1, 1, 1, 0};
+    int i231[] = {1, 1, 0, 1, 1, 1, 1};
+    int i232[] = {1, 1, 1, 0, 0, 0, 0};
+    int i233[] = {1, 1, 1, 0, 0, 0, 1};
+    int i234[] = {1, 1, 1, 0, 0, 1, 0};
+    int i235[] = {1, 1, 1, 0, 0, 1, 1};
+    int i236[] = {1, 1, 1, 0, 1, 0, 0};
+    int i237[] = {1, 1, 1, 0, 1, 0, 1};
+    int i238[] = {1, 1, 1, 0, 1, 1, 0};
+    int i239[] = {1, 1, 1, 0, 1, 1, 1};
+    int i240[] = {1, 1, 1, 1, 0, 0, 0};
+    int i241[] = {1, 1, 1, 1, 0, 0, 1};
+    int i242[] = {1, 1, 1, 1, 0, 1, 0};
+    int i243[] = {1, 1, 1, 1, 0, 1, 1};
+    int i244[] = {1, 1, 1, 1, 1, 0, 0};
+    int i245[] = {1, 1, 1, 1, 1, 0, 1};
+    int i246[] = {1, 1, 1, 1, 1, 1, 0};
+    assert(std::is_heap_until(i120, i120+7, std::greater<int>()) == i120+7);
+    assert(std::is_heap_until(i121, i121+7, std::greater<int>()) == i121+7);
+    assert(std::is_heap_until(i122, i122+7, std::greater<int>()) == i122+7);
+    assert(std::is_heap_until(i123, i123+7, std::greater<int>()) == i123+7);
+    assert(std::is_heap_until(i124, i124+7, std::greater<int>()) == i124+7);
+    assert(std::is_heap_until(i125, i125+7, std::greater<int>()) == i125+7);
+    assert(std::is_heap_until(i126, i126+7, std::greater<int>()) == i126+7);
+    assert(std::is_heap_until(i127, i127+7, std::greater<int>()) == i127+7);
+    assert(std::is_heap_until(i128, i128+7, std::greater<int>()) == i128+7);
+    assert(std::is_heap_until(i129, i129+7, std::greater<int>()) == i129+7);
+    assert(std::is_heap_until(i130, i130+7, std::greater<int>()) == i130+7);
+    assert(std::is_heap_until(i131, i131+7, std::greater<int>()) == i131+7);
+    assert(std::is_heap_until(i132, i132+7, std::greater<int>()) == i132+7);
+    assert(std::is_heap_until(i133, i133+7, std::greater<int>()) == i133+7);
+    assert(std::is_heap_until(i134, i134+7, std::greater<int>()) == i134+7);
+    assert(std::is_heap_until(i135, i135+7, std::greater<int>()) == i135+7);
+    assert(std::is_heap_until(i136, i136+7, std::greater<int>()) == i136+5);
+    assert(std::is_heap_until(i137, i137+7, std::greater<int>()) == i137+5);
+    assert(std::is_heap_until(i138, i138+7, std::greater<int>()) == i138+6);
+    assert(std::is_heap_until(i139, i139+7, std::greater<int>()) == i139+7);
+    assert(std::is_heap_until(i140, i140+7, std::greater<int>()) == i140+5);
+    assert(std::is_heap_until(i141, i141+7, std::greater<int>()) == i141+5);
+    assert(std::is_heap_until(i142, i142+7, std::greater<int>()) == i142+6);
+    assert(std::is_heap_until(i143, i143+7, std::greater<int>()) == i143+7);
+    assert(std::is_heap_until(i144, i144+7, std::greater<int>()) == i144+5);
+    assert(std::is_heap_until(i145, i145+7, std::greater<int>()) == i145+5);
+    assert(std::is_heap_until(i146, i146+7, std::greater<int>()) == i146+6);
+    assert(std::is_heap_until(i147, i147+7, std::greater<int>()) == i147+7);
+    assert(std::is_heap_until(i148, i148+7, std::greater<int>()) == i148+5);
+    assert(std::is_heap_until(i149, i149+7, std::greater<int>()) == i149+5);
+    assert(std::is_heap_until(i150, i150+7, std::greater<int>()) == i150+6);
+    assert(std::is_heap_until(i151, i151+7, std::greater<int>()) == i151+7);
+    assert(std::is_heap_until(i152, i152+7, std::greater<int>()) == i152+3);
+    assert(std::is_heap_until(i153, i153+7, std::greater<int>()) == i153+3);
+    assert(std::is_heap_until(i154, i154+7, std::greater<int>()) == i154+3);
+    assert(std::is_heap_until(i155, i155+7, std::greater<int>()) == i155+3);
+    assert(std::is_heap_until(i156, i156+7, std::greater<int>()) == i156+3);
+    assert(std::is_heap_until(i157, i157+7, std::greater<int>()) == i157+3);
+    assert(std::is_heap_until(i158, i158+7, std::greater<int>()) == i158+3);
+    assert(std::is_heap_until(i159, i159+7, std::greater<int>()) == i159+3);
+    assert(std::is_heap_until(i160, i160+7, std::greater<int>()) == i160+4);
+    assert(std::is_heap_until(i161, i161+7, std::greater<int>()) == i161+4);
+    assert(std::is_heap_until(i162, i162+7, std::greater<int>()) == i162+4);
+    assert(std::is_heap_until(i163, i163+7, std::greater<int>()) == i163+4);
+    assert(std::is_heap_until(i164, i164+7, std::greater<int>()) == i164+7);
+    assert(std::is_heap_until(i165, i165+7, std::greater<int>()) == i165+7);
+    assert(std::is_heap_until(i166, i166+7, std::greater<int>()) == i166+7);
+    assert(std::is_heap_until(i167, i167+7, std::greater<int>()) == i167+7);
+    assert(std::is_heap_until(i168, i168+7, std::greater<int>()) == i168+3);
+    assert(std::is_heap_until(i169, i169+7, std::greater<int>()) == i169+3);
+    assert(std::is_heap_until(i170, i170+7, std::greater<int>()) == i170+3);
+    assert(std::is_heap_until(i171, i171+7, std::greater<int>()) == i171+3);
+    assert(std::is_heap_until(i172, i172+7, std::greater<int>()) == i172+3);
+    assert(std::is_heap_until(i173, i173+7, std::greater<int>()) == i173+3);
+    assert(std::is_heap_until(i174, i174+7, std::greater<int>()) == i174+3);
+    assert(std::is_heap_until(i175, i175+7, std::greater<int>()) == i175+3);
+    assert(std::is_heap_until(i176, i176+7, std::greater<int>()) == i176+4);
+    assert(std::is_heap_until(i177, i177+7, std::greater<int>()) == i177+4);
+    assert(std::is_heap_until(i178, i178+7, std::greater<int>()) == i178+4);
+    assert(std::is_heap_until(i179, i179+7, std::greater<int>()) == i179+4);
+    assert(std::is_heap_until(i180, i180+7, std::greater<int>()) == i180+5);
+    assert(std::is_heap_until(i181, i181+7, std::greater<int>()) == i181+5);
+    assert(std::is_heap_until(i182, i182+7, std::greater<int>()) == i182+6);
+    assert(std::is_heap_until(i183, i183+7, std::greater<int>()) == i183+7);
+    assert(std::is_heap_until(i184, i184+7, std::greater<int>()) == i184+1);
+    assert(std::is_heap_until(i185, i185+7, std::greater<int>()) == i185+1);
+    assert(std::is_heap_until(i186, i186+7, std::greater<int>()) == i186+1);
+    assert(std::is_heap_until(i187, i187+7, std::greater<int>()) == i187+1);
+    assert(std::is_heap_until(i188, i188+7, std::greater<int>()) == i188+1);
+    assert(std::is_heap_until(i189, i189+7, std::greater<int>()) == i189+1);
+    assert(std::is_heap_until(i190, i190+7, std::greater<int>()) == i190+1);
+    assert(std::is_heap_until(i191, i191+7, std::greater<int>()) == i191+1);
+    assert(std::is_heap_until(i192, i192+7, std::greater<int>()) == i192+1);
+    assert(std::is_heap_until(i193, i193+7, std::greater<int>()) == i193+1);
+    assert(std::is_heap_until(i194, i194+7, std::greater<int>()) == i194+1);
+    assert(std::is_heap_until(i195, i195+7, std::greater<int>()) == i195+1);
+    assert(std::is_heap_until(i196, i196+7, std::greater<int>()) == i196+1);
+    assert(std::is_heap_until(i197, i197+7, std::greater<int>()) == i197+1);
+    assert(std::is_heap_until(i198, i198+7, std::greater<int>()) == i198+1);
+    assert(std::is_heap_until(i199, i199+7, std::greater<int>()) == i199+1);
+    assert(std::is_heap_until(i200, i200+7, std::greater<int>()) == i200+1);
+    assert(std::is_heap_until(i201, i201+7, std::greater<int>()) == i201+1);
+    assert(std::is_heap_until(i202, i202+7, std::greater<int>()) == i202+1);
+    assert(std::is_heap_until(i203, i203+7, std::greater<int>()) == i203+1);
+    assert(std::is_heap_until(i204, i204+7, std::greater<int>()) == i204+1);
+    assert(std::is_heap_until(i205, i205+7, std::greater<int>()) == i205+1);
+    assert(std::is_heap_until(i206, i206+7, std::greater<int>()) == i206+1);
+    assert(std::is_heap_until(i207, i207+7, std::greater<int>()) == i207+1);
+    assert(std::is_heap_until(i208, i208+7, std::greater<int>()) == i208+1);
+    assert(std::is_heap_until(i209, i209+7, std::greater<int>()) == i209+1);
+    assert(std::is_heap_until(i210, i210+7, std::greater<int>()) == i210+1);
+    assert(std::is_heap_until(i211, i211+7, std::greater<int>()) == i211+1);
+    assert(std::is_heap_until(i212, i212+7, std::greater<int>()) == i212+1);
+    assert(std::is_heap_until(i213, i213+7, std::greater<int>()) == i213+1);
+    assert(std::is_heap_until(i214, i214+7, std::greater<int>()) == i214+1);
+    assert(std::is_heap_until(i215, i215+7, std::greater<int>()) == i215+1);
+    assert(std::is_heap_until(i216, i216+7, std::greater<int>()) == i216+2);
+    assert(std::is_heap_until(i217, i217+7, std::greater<int>()) == i217+2);
+    assert(std::is_heap_until(i218, i218+7, std::greater<int>()) == i218+2);
+    assert(std::is_heap_until(i219, i219+7, std::greater<int>()) == i219+2);
+    assert(std::is_heap_until(i220, i220+7, std::greater<int>()) == i220+2);
+    assert(std::is_heap_until(i221, i221+7, std::greater<int>()) == i221+2);
+    assert(std::is_heap_until(i222, i222+7, std::greater<int>()) == i222+2);
+    assert(std::is_heap_until(i223, i223+7, std::greater<int>()) == i223+2);
+    assert(std::is_heap_until(i224, i224+7, std::greater<int>()) == i224+2);
+    assert(std::is_heap_until(i225, i225+7, std::greater<int>()) == i225+2);
+    assert(std::is_heap_until(i226, i226+7, std::greater<int>()) == i226+2);
+    assert(std::is_heap_until(i227, i227+7, std::greater<int>()) == i227+2);
+    assert(std::is_heap_until(i228, i228+7, std::greater<int>()) == i228+2);
+    assert(std::is_heap_until(i229, i229+7, std::greater<int>()) == i229+2);
+    assert(std::is_heap_until(i230, i230+7, std::greater<int>()) == i230+2);
+    assert(std::is_heap_until(i231, i231+7, std::greater<int>()) == i231+2);
+    assert(std::is_heap_until(i232, i232+7, std::greater<int>()) == i232+3);
+    assert(std::is_heap_until(i233, i233+7, std::greater<int>()) == i233+3);
+    assert(std::is_heap_until(i234, i234+7, std::greater<int>()) == i234+3);
+    assert(std::is_heap_until(i235, i235+7, std::greater<int>()) == i235+3);
+    assert(std::is_heap_until(i236, i236+7, std::greater<int>()) == i236+3);
+    assert(std::is_heap_until(i237, i237+7, std::greater<int>()) == i237+3);
+    assert(std::is_heap_until(i238, i238+7, std::greater<int>()) == i238+3);
+    assert(std::is_heap_until(i239, i239+7, std::greater<int>()) == i239+3);
+    assert(std::is_heap_until(i240, i240+7, std::greater<int>()) == i240+4);
+    assert(std::is_heap_until(i241, i241+7, std::greater<int>()) == i241+4);
+    assert(std::is_heap_until(i242, i242+7, std::greater<int>()) == i242+4);
+    assert(std::is_heap_until(i243, i243+7, std::greater<int>()) == i243+4);
+    assert(std::is_heap_until(i244, i244+7, std::greater<int>()) == i244+5);
+    assert(std::is_heap_until(i245, i245+7, std::greater<int>()) == i245+5);
+    assert(std::is_heap_until(i246, i246+7, std::greater<int>()) == i246+6);
+}
+
+int main()
+{
+    test();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter> && LessThanComparable<Iter::value_type>
+//   void
+//   make_heap(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N);
+    assert(std::is_heap(ia, ia+N));
+    delete [] ia;
+}
+
+int main()
+{
+    test(0);
+    test(1);
+    test(2);
+    test(3);
+    test(10);
+    test(1000);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter> && CopyConstructible<Compare>
+//   void
+//   make_heap(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "counting_predicates.hpp"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    {
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, std::greater<int>());
+    assert(std::is_heap(ia, ia+N, std::greater<int>()));
+    }
+
+//  Ascending
+    {
+    binary_counting_predicate<std::greater<int>, int, int> pred ((std::greater<int>()));
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::make_heap(ia, ia+N, std::ref(pred));
+    assert(pred.count() <= 3*N);
+    assert(std::is_heap(ia, ia+N, pred));
+    }
+
+//  Descending
+    {
+    binary_counting_predicate<std::greater<int>, int, int> pred ((std::greater<int>()));
+    for (int i = 0; i < N; ++i)
+        ia[N-1-i] = i;
+    std::make_heap(ia, ia+N, std::ref(pred));
+    assert(pred.count() <= 3*N);
+    assert(std::is_heap(ia, ia+N, pred));
+    }
+
+//  Random
+    {
+    binary_counting_predicate<std::greater<int>, int, int> pred ((std::greater<int>()));
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, std::ref(pred));
+    assert(pred.count() <= 3*N);
+    assert(std::is_heap(ia, ia+N, pred));   
+    }
+
+    delete [] ia;
+}
+
+int main()
+{
+    test(0);
+    test(1);
+    test(2);
+    test(3);
+    test(10);
+    test(1000);
+    test(10000);
+    test(100000);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    const int N = 1000;
+    std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
+    for (int i = 0; i < N; ++i)
+        ia[i].reset(new int(i));
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, indirect_less());
+    assert(std::is_heap(ia, ia+N, indirect_less()));
+    delete [] ia;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/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/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter> && LessThanComparable<Iter::value_type>
+//   void
+//   pop_heap(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N);
+    for (int i = N; i > 0; --i)
+    {
+        std::pop_heap(ia, ia+i);
+        assert(std::is_heap(ia, ia+i-1));
+    }
+    std::pop_heap(ia, ia);
+    delete [] ia;
+}
+
+int main()
+{
+    test(1000);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter> && CopyConstructible<Compare>
+//   void
+//   pop_heap(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, std::greater<int>());
+    for (int i = N; i > 0; --i)
+    {
+        std::pop_heap(ia, ia+i, std::greater<int>());
+        assert(std::is_heap(ia, ia+i-1, std::greater<int>()));
+    }
+    std::pop_heap(ia, ia, std::greater<int>());
+    delete [] ia;
+}
+
+int main()
+{
+    test(1000);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    const int N = 1000;
+    std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
+    for (int i = 0; i < N; ++i)
+        ia[i].reset(new int(i));
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, indirect_less());
+    for (int i = N; i > 0; --i)
+    {
+        std::pop_heap(ia, ia+i, indirect_less());
+        assert(std::is_heap(ia, ia+i-1, indirect_less()));
+    }
+    delete [] ia;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   void
+//   push_heap(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    for (int i = 0; i <= N; ++i)
+    {
+        std::push_heap(ia, ia+i);
+        assert(std::is_heap(ia, ia+i));
+    }
+    delete [] ia;
+}
+
+int main()
+{
+    test(1000);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   void
+//   push_heap(Iter first, Iter last);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    for (int i = 0; i <= N; ++i)
+    {
+        std::push_heap(ia, ia+i, std::greater<int>());
+        assert(std::is_heap(ia, ia+i, std::greater<int>()));
+    }
+    delete [] ia;
+}
+
+int main()
+{
+    test(1000);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    const int N = 1000;
+    std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
+    for (int i = 0; i < N; ++i)
+        ia[i].reset(new int(i));
+    std::random_shuffle(ia, ia+N);
+    for (int i = 0; i <= N; ++i)
+    {
+        std::push_heap(ia, ia+i, indirect_less());
+        assert(std::is_heap(ia, ia+i, indirect_less()));
+    }
+    delete [] ia;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter> && LessThanComparable<Iter::value_type>
+//   void
+//   sort_heap(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N);
+    std::sort_heap(ia, ia+N);
+    assert(std::is_sorted(ia, ia+N));
+    delete [] ia;
+}
+
+int main()
+{
+    test(0);
+    test(1);
+    test(2);
+    test(3);
+    test(10);
+    test(1000);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter> && CopyConstructible<Compare>
+//   void
+//   sort_heap(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+void test(unsigned N)
+{
+    int* ia = new int [N];
+    for (int i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, std::greater<int>());
+    std::sort_heap(ia, ia+N, std::greater<int>());
+    assert(std::is_sorted(ia, ia+N, std::greater<int>()));
+    delete [] ia;
+}
+
+int main()
+{
+    test(0);
+    test(1);
+    test(2);
+    test(3);
+    test(10);
+    test(1000);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    const int N = 1000;
+    std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
+    for (int i = 0; i < N; ++i)
+        ia[i].reset(new int(i));
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, indirect_less());
+    std::sort_heap(ia, ia+N, indirect_less());
+    assert(std::is_sorted(ia, ia+N, indirect_less()));
+    delete [] ia;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator Iter1, InputIterator Iter2>
+//   requires HasLess<Iter1::value_type, Iter2::value_type>
+//         && HasLess<Iter2::value_type, Iter1::value_type>
+//   bool
+//   lexicographical_compare(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+    int ia[] = {1, 2, 3, 4};
+    const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {1, 2, 3};
+    assert(!std::lexicographical_compare(Iter1(ia),   Iter1(ia+sa), Iter2(ib),   Iter2(ib+2)));
+    assert( std::lexicographical_compare(Iter1(ib),   Iter1(ib+2),  Iter2(ia),   Iter2(ia+sa)));
+    assert(!std::lexicographical_compare(Iter1(ia),   Iter1(ia+sa), Iter2(ib),   Iter2(ib+3)));
+    assert( std::lexicographical_compare(Iter1(ib),   Iter1(ib+3),  Iter2(ia),   Iter2(ia+sa)));
+    assert( std::lexicographical_compare(Iter1(ia),   Iter1(ia+sa), Iter2(ib+1), Iter2(ib+3)));
+    assert(!std::lexicographical_compare(Iter1(ib+1), Iter1(ib+3),  Iter2(ia),   Iter2(ia+sa)));
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*> >();
+    test<input_iterator<const int*>, const int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+    test<forward_iterator<const int*>, const int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, const int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+    test<random_access_iterator<const int*>, const int*>();
+
+    test<const int*, input_iterator<const int*> >();
+    test<const int*, forward_iterator<const int*> >();
+    test<const int*, bidirectional_iterator<const int*> >();
+    test<const int*, random_access_iterator<const int*> >();
+    test<const int*, const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator Iter1, InputIterator Iter2, CopyConstructible Compare>
+//   requires Predicate<Compare, Iter1::value_type, Iter2::value_type>
+//         && Predicate<Compare, Iter2::value_type, Iter1::value_type>
+//   bool
+//   lexicographical_compare(Iter1 first1, Iter1 last1,
+//                           Iter2 first2, Iter2 last2, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+    int ia[] = {1, 2, 3, 4};
+    const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {1, 2, 3};
+    typedef std::greater<int> C;
+    C c;
+    assert(!std::lexicographical_compare(Iter1(ia),   Iter1(ia+sa), Iter2(ib),   Iter2(ib+2),  c));
+    assert( std::lexicographical_compare(Iter1(ib),   Iter1(ib+2),  Iter2(ia),   Iter2(ia+sa), c));
+    assert(!std::lexicographical_compare(Iter1(ia),   Iter1(ia+sa), Iter2(ib),   Iter2(ib+3),  c));
+    assert( std::lexicographical_compare(Iter1(ib),   Iter1(ib+3),  Iter2(ia),   Iter2(ia+sa), c));
+    assert(!std::lexicographical_compare(Iter1(ia),   Iter1(ia+sa), Iter2(ib+1), Iter2(ib+3),  c));
+    assert( std::lexicographical_compare(Iter1(ib+1), Iter1(ib+3),  Iter2(ia),   Iter2(ia+sa), c));
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*> >();
+    test<input_iterator<const int*>, const int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+    test<forward_iterator<const int*>, const int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, const int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+    test<random_access_iterator<const int*>, const int*>();
+
+    test<const int*, input_iterator<const int*> >();
+    test<const int*, forward_iterator<const int*> >();
+    test<const int*, bidirectional_iterator<const int*> >();
+    test<const int*, random_access_iterator<const int*> >();
+    test<const int*, const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<BidirectionalIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   void
+//   inplace_merge(Iter first, Iter middle, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test_one(unsigned N, unsigned M)
+{
+    assert(M <= N);
+    int* ia = new int[N];
+    for (unsigned i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::sort(ia, ia+M);
+    std::sort(ia+M, ia+N);
+    std::inplace_merge(Iter(ia), Iter(ia+M), Iter(ia+N));
+    if(N > 0)
+    {
+        assert(ia[0] == 0);
+        assert(ia[N-1] == N-1);
+        assert(std::is_sorted(ia, ia+N));
+    }
+    delete [] ia;
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    test_one<Iter>(N, 0);
+    test_one<Iter>(N, N/4);
+    test_one<Iter>(N, N/2);
+    test_one<Iter>(N, 3*N/4);
+    test_one<Iter>(N, N);
+}
+
+template <class Iter>
+void
+test()
+{
+    test_one<Iter>(0, 0);
+    test_one<Iter>(1, 0);
+    test_one<Iter>(1, 1);
+    test_one<Iter>(2, 0);
+    test_one<Iter>(2, 1);
+    test_one<Iter>(2, 2);
+    test_one<Iter>(3, 0);
+    test_one<Iter>(3, 1);
+    test_one<Iter>(3, 2);
+    test_one<Iter>(3, 3);
+    test<Iter>(4);
+    test<Iter>(100);
+    test<Iter>(1000);
+}
+
+int main()
+{
+    test<bidirectional_iterator<int*> >();
+    test<random_access_iterator<int*> >();
+    test<int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<BidirectionalIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter>
+//         && CopyConstructible<Compare>
+//   void
+//   inplace_merge(Iter first, Iter middle, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test_one(unsigned N, unsigned M)
+{
+    assert(M <= N);
+    int* ia = new int[N];
+    for (unsigned i = 0; i < N; ++i)
+        ia[i] = i;
+    std::random_shuffle(ia, ia+N);
+    std::sort(ia, ia+M, std::greater<int>());
+    std::sort(ia+M, ia+N, std::greater<int>());
+    std::inplace_merge(Iter(ia), Iter(ia+M), Iter(ia+N), std::greater<int>());
+    if(N > 0)
+    {
+        assert(ia[0] == N-1);
+        assert(ia[N-1] == 0);
+        assert(std::is_sorted(ia, ia+N, std::greater<int>()));
+    }
+    delete [] ia;
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    test_one<Iter>(N, 0);
+    test_one<Iter>(N, N/4);
+    test_one<Iter>(N, N/2);
+    test_one<Iter>(N, 3*N/4);
+    test_one<Iter>(N, N);
+}
+
+template <class Iter>
+void
+test()
+{
+    test_one<Iter>(0, 0);
+    test_one<Iter>(1, 0);
+    test_one<Iter>(1, 1);
+    test_one<Iter>(2, 0);
+    test_one<Iter>(2, 1);
+    test_one<Iter>(2, 2);
+    test_one<Iter>(3, 0);
+    test_one<Iter>(3, 1);
+    test_one<Iter>(3, 2);
+    test_one<Iter>(3, 3);
+    test<Iter>(4);
+    test<Iter>(100);
+    test<Iter>(1000);
+}
+
+int main()
+{
+    test<bidirectional_iterator<int*> >();
+    test<random_access_iterator<int*> >();
+    test<int*>();
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    unsigned N = 100;
+    unsigned M = 50;
+    std::unique_ptr<int>* ia = new std::unique_ptr<int>[N];
+    for (unsigned i = 0; i < N; ++i)
+        ia[i].reset(new int(i));
+    std::random_shuffle(ia, ia+N);
+    std::sort(ia, ia+M, indirect_less());
+    std::sort(ia+M, ia+N, indirect_less());
+    std::inplace_merge(ia, ia+M, ia+N, indirect_less());
+    if(N > 0)
+    {
+        assert(*ia[0] == 0);
+        assert(*ia[N-1] == N-1);
+        assert(std::is_sorted(ia, ia+N, indirect_less()));
+    }
+    delete [] ia;
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,224 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && HasLess<InIter2::value_type, InIter1::value_type>
+//   OutIter
+//   merge(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2, OutIter result);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class InIter1, class InIter2, class OutIter>
+void
+test()
+{
+    {
+    unsigned N = 100000;
+    int* ia = new int[N];
+    int* ib = new int[N];
+    int* ic = new int[2*N];
+    for (unsigned i = 0; i < N; ++i)
+        ia[i] = 2*i;
+    for (unsigned i = 0; i < N; ++i)
+        ib[i] = 2*i+1;
+    OutIter r = std::merge(InIter1(ia), InIter1(ia+N),
+                           InIter2(ib), InIter2(ib+N), OutIter(ic));
+    assert(base(r) == ic+2*N);
+    assert(ic[0] == 0);
+    assert(ic[2*N-1] == 2*N-1);
+    assert(std::is_sorted(ic, ic+2*N));
+    delete [] ic;
+    delete [] ib;
+    delete [] ia;
+    }
+    {
+    unsigned N = 100;
+    int* ia = new int[N];
+    int* ib = new int[N];
+    int* ic = new int[2*N];
+    for (unsigned i = 0; i < 2*N; ++i)
+        ic[i] = i;
+    std::random_shuffle(ic, ic+2*N);
+    std::copy(ic, ic+N, ia);
+    std::copy(ic+N, ic+2*N, ib);
+    std::sort(ia, ia+N);
+    std::sort(ib, ib+N);
+    OutIter r = std::merge(InIter1(ia), InIter1(ia+N),
+                           InIter2(ib), InIter2(ib+N), OutIter(ic));
+    assert(base(r) == ic+2*N);
+    assert(ic[0] == 0);
+    assert(ic[2*N-1] == 2*N-1);
+    assert(std::is_sorted(ic, ic+2*N));
+    delete [] ic;
+    delete [] ib;
+    delete [] ia;
+    }
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,229 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
+//          Predicate<auto, InIter2::value_type, InIter1::value_type> Compare>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && CopyConstructible<Compare>
+//   OutIter
+//   merge(InIter1 first1, InIter1 last1,
+//         InIter2 first2, InIter2 last2, OutIter result, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class InIter1, class InIter2, class OutIter>
+void
+test()
+{
+    {
+    unsigned N = 100000;
+    int* ia = new int[N];
+    int* ib = new int[N];
+    int* ic = new int[2*N];
+    for (unsigned i = 0; i < N; ++i)
+        ia[i] = 2*i;
+    for (unsigned i = 0; i < N; ++i)
+        ib[i] = 2*i+1;
+    std::reverse(ia, ia+N);
+    std::reverse(ib, ib+N);
+    OutIter r = std::merge(InIter1(ia), InIter1(ia+N),
+                           InIter2(ib), InIter2(ib+N), OutIter(ic), std::greater<int>());
+    assert(base(r) == ic+2*N);
+    assert(ic[0] == 2*N-1);
+    assert(ic[2*N-1] == 0);
+    assert(std::is_sorted(ic, ic+2*N, std::greater<int>()));
+    delete [] ic;
+    delete [] ib;
+    delete [] ia;
+    }
+    {
+    unsigned N = 100;
+    int* ia = new int[N];
+    int* ib = new int[N];
+    int* ic = new int[2*N];
+    for (unsigned i = 0; i < 2*N; ++i)
+        ic[i] = i;
+    std::random_shuffle(ic, ic+2*N);
+    std::copy(ic, ic+N, ia);
+    std::copy(ic+N, ic+2*N, ib);
+    std::sort(ia, ia+N, std::greater<int>());
+    std::sort(ib, ib+N, std::greater<int>());
+    OutIter r = std::merge(InIter1(ia), InIter1(ia+N),
+                           InIter2(ib), InIter2(ib+N), OutIter(ic), std::greater<int>());
+    assert(base(r) == ic+2*N);
+    assert(ic[0] == 2*N-1);
+    assert(ic[2*N-1] == 0);
+    assert(std::is_sorted(ic, ic+2*N, std::greater<int>()));
+    delete [] ic;
+    delete [] ib;
+    delete [] ia;
+    }
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<LessThanComparable T>
+//   const T&
+//   max(const T& a, const T& b);
+
+#include <algorithm>
+#include <cassert>
+
+template <class T>
+void
+test(const T& a, const T& b, const T& x)
+{
+    assert(&std::max(a, b) == &x);
+}
+
+int main()
+{
+    {
+    int x = 0;
+    int y = 0;
+    test(x, y, x);
+    test(y, x, y);
+    }
+    {
+    int x = 0;
+    int y = 1;
+    test(x, y, y);
+    test(y, x, y);
+    }
+    {
+    int x = 1;
+    int y = 0;
+    test(x, y, x);
+    test(y, x, x);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr int x = 1;
+    constexpr int y = 0;
+    static_assert(std::max(x, y) == x, "" );
+    static_assert(std::max(y, x) == x, "" );
+    }
+#endif
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T, StrictWeakOrder<auto, T> Compare>
+//   requires !SameType<T, Compare> && CopyConstructible<Compare>
+//   const T&
+//   max(const T& a, const T& b, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+template <class T, class C>
+void
+test(const T& a, const T& b, C c, const T& x)
+{
+    assert(&std::max(a, b, c) == &x);
+}
+
+int main()
+{
+    {
+    int x = 0;
+    int y = 0;
+    test(x, y, std::greater<int>(), x);
+    test(y, x, std::greater<int>(), y);
+    }
+    {
+    int x = 0;
+    int y = 1;
+    test(x, y, std::greater<int>(), x);
+    test(y, x, std::greater<int>(), x);
+    }
+    {
+    int x = 1;
+    int y = 0;
+    test(x, y, std::greater<int>(), y);
+    test(y, x, std::greater<int>(), y);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr int x = 1;
+    constexpr int y = 0;
+    static_assert(std::max(x, y, std::greater<int>()) == y, "" );
+    static_assert(std::max(y, x, std::greater<int>()) == y, "" );
+    }
+#endif
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter>
+//   requires LessThanComparable<Iter::value_type>
+//   Iter
+//   max_element(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last)
+{
+    Iter i = std::max_element(first, last);
+    if (first != last)
+    {
+        for (Iter j = first; j != last; ++j)
+            assert(!(*i < *j));
+    }
+    else
+        assert(i == last);
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = i;
+    std::random_shuffle(a, a+N);
+    test(Iter(a), Iter(a+N));
+    delete [] a;
+}
+
+template <class Iter>
+void
+test()
+{
+    test<Iter>(0);
+    test<Iter>(1);
+    test<Iter>(2);
+    test<Iter>(3);
+    test<Iter>(10);
+    test<Iter>(1000);
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires CopyConstructible<Compare>
+//   Iter
+//   max_element(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last)
+{
+    Iter i = std::max_element(first, last, std::greater<int>());
+    if (first != last)
+    {
+        for (Iter j = first; j != last; ++j)
+            assert(!std::greater<int>()(*i, *j));
+    }
+    else
+        assert(i == last);
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = i;
+    std::random_shuffle(a, a+N);
+    test(Iter(a), Iter(a+N));
+    delete [] a;
+}
+
+template <class Iter>
+void
+test()
+{
+    test<Iter>(0);
+    test<Iter>(1);
+    test<Iter>(2);
+    test<Iter>(3);
+    test<Iter>(10);
+    test<Iter>(1000);
+}
+
+template <class Iter, class Pred>
+void test_eq0(Iter first, Iter last, Pred p)
+{
+    assert(first == std::max_element(first, last, p));
+}
+
+void test_eq()
+{
+    const size_t N = 10;
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = 10; // all the same
+    test_eq0(a, a+N, std::less<int>());
+    test_eq0(a, a+N, std::greater<int>());
+    delete [] a;
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+    test_eq();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template <class T>
+//   T
+//   max(initializer_list<T> t);
+
+#include <algorithm>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    int i = std::max({2, 3, 1});
+    assert(i == 3);
+    i = std::max({2, 1, 3});
+    assert(i == 3);
+    i = std::max({3, 1, 2});
+    assert(i == 3);
+    i = std::max({3, 2, 1});
+    assert(i == 3);
+    i = std::max({1, 2, 3});
+    assert(i == 3);
+    i = std::max({1, 3, 2});
+    assert(i == 3);
+#if _LIBCPP_STD_VER > 11
+    {
+    static_assert(std::max({1, 3, 2}) == 3, "");
+    static_assert(std::max({2, 1, 3}) == 3, "");
+    static_assert(std::max({3, 2, 1}) == 3, "");
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T, class Compare>
+//   T
+//   max(initializer_list<T> t, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    int i = std::max({2, 3, 1}, std::greater<int>());
+    assert(i == 1);
+    i = std::max({2, 1, 3}, std::greater<int>());
+    assert(i == 1);
+    i = std::max({3, 1, 2}, std::greater<int>());
+    assert(i == 1);
+    i = std::max({3, 2, 1}, std::greater<int>());
+    assert(i == 1);
+    i = std::max({1, 2, 3}, std::greater<int>());
+    assert(i == 1);
+    i = std::max({1, 3, 2}, std::greater<int>());
+    assert(i == 1);
+#if _LIBCPP_STD_VER > 11
+    {
+    static_assert(std::max({1, 3, 2}, std::greater<int>()) == 1, "");
+    static_assert(std::max({2, 1, 3}, std::greater<int>()) == 1, "");
+    static_assert(std::max({3, 2, 1}, std::greater<int>()) == 1, "");
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<LessThanComparable T>
+//   const T&
+//   min(const T& a, const T& b);
+
+#include <algorithm>
+#include <cassert>
+
+template <class T>
+void
+test(const T& a, const T& b, const T& x)
+{
+    assert(&std::min(a, b) == &x);
+}
+
+int main()
+{
+    {
+    int x = 0;
+    int y = 0;
+    test(x, y, x);
+    test(y, x, y);
+    }
+    {
+    int x = 0;
+    int y = 1;
+    test(x, y, x);
+    test(y, x, x);
+    }
+    {
+    int x = 1;
+    int y = 0;
+    test(x, y, y);
+    test(y, x, y);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr int x = 1;
+    constexpr int y = 0;
+    static_assert(std::min(x, y) == y, "" );
+    static_assert(std::min(y, x) == y, "" );
+    }
+#endif
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T, StrictWeakOrder<auto, T> Compare>
+//   requires !SameType<T, Compare> && CopyConstructible<Compare>
+//   const T&
+//   min(const T& a, const T& b, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+template <class T, class C>
+void
+test(const T& a, const T& b, C c, const T& x)
+{
+    assert(&std::min(a, b, c) == &x);
+}
+
+int main()
+{
+    {
+    int x = 0;
+    int y = 0;
+    test(x, y, std::greater<int>(), x);
+    test(y, x, std::greater<int>(), y);
+    }
+    {
+    int x = 0;
+    int y = 1;
+    test(x, y, std::greater<int>(), y);
+    test(y, x, std::greater<int>(), y);
+    }
+    {
+    int x = 1;
+    int y = 0;
+    test(x, y, std::greater<int>(), x);
+    test(y, x, std::greater<int>(), x);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr int x = 1;
+    constexpr int y = 0;
+    static_assert(std::min(x, y, std::greater<int>()) == x, "" );
+    static_assert(std::min(y, x, std::greater<int>()) == x, "" );
+    }
+#endif
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter>
+//   requires LessThanComparable<Iter::value_type>
+//   Iter
+//   min_element(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last)
+{
+    Iter i = std::min_element(first, last);
+    if (first != last)
+    {
+        for (Iter j = first; j != last; ++j)
+            assert(!(*j < *i));
+    }
+    else
+        assert(i == last);
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = i;
+    std::random_shuffle(a, a+N);
+    test(Iter(a), Iter(a+N));
+    delete [] a;
+}
+
+template <class Iter>
+void
+test()
+{
+    test<Iter>(0);
+    test<Iter>(1);
+    test<Iter>(2);
+    test<Iter>(3);
+    test<Iter>(10);
+    test<Iter>(1000);
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires CopyConstructible<Compare>
+//   Iter
+//   min_element(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last)
+{
+    Iter i = std::min_element(first, last, std::greater<int>());
+    if (first != last)
+    {
+        for (Iter j = first; j != last; ++j)
+            assert(!std::greater<int>()(*j, *i));
+    }
+    else
+        assert(i == last);
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = i;
+    std::random_shuffle(a, a+N);
+    test(Iter(a), Iter(a+N));
+    delete [] a;
+}
+
+template <class Iter>
+void
+test()
+{
+    test<Iter>(0);
+    test<Iter>(1);
+    test<Iter>(2);
+    test<Iter>(3);
+    test<Iter>(10);
+    test<Iter>(1000);
+}
+
+template <class Iter, class Pred>
+void test_eq0(Iter first, Iter last, Pred p)
+{
+    assert(first == std::min_element(first, last, p));
+}
+
+void test_eq()
+{
+    const size_t N = 10;
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = 10; // all the same
+    test_eq0(a, a+N, std::less<int>());
+    test_eq0(a, a+N, std::greater<int>());
+    delete [] a;
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+    test_eq();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T>
+//   T
+//   min(initializer_list<T> t);
+
+#include <algorithm>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    int i = std::min({2, 3, 1});
+    assert(i == 1);
+    i = std::min({2, 1, 3});
+    assert(i == 1);
+    i = std::min({3, 1, 2});
+    assert(i == 1);
+    i = std::min({3, 2, 1});
+    assert(i == 1);
+    i = std::min({1, 2, 3});
+    assert(i == 1);
+    i = std::min({1, 3, 2});
+    assert(i == 1);
+#if _LIBCPP_STD_VER > 11
+    {
+    static_assert(std::min({1, 3, 2}) == 1, "");
+    static_assert(std::min({2, 1, 3}) == 1, "");
+    static_assert(std::min({3, 2, 1}) == 1, "");
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T, class Compare>
+//   T
+//   min(initializer_list<T> t, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    int i = std::min({2, 3, 1}, std::greater<int>());
+    assert(i == 3);
+    i = std::min({2, 1, 3}, std::greater<int>());
+    assert(i == 3);
+    i = std::min({3, 1, 2}, std::greater<int>());
+    assert(i == 3);
+    i = std::min({3, 2, 1}, std::greater<int>());
+    assert(i == 3);
+    i = std::min({1, 2, 3}, std::greater<int>());
+    assert(i == 3);
+    i = std::min({1, 3, 2}, std::greater<int>());
+    assert(i == 3);
+#if _LIBCPP_STD_VER > 11
+    {
+    static_assert(std::min({1, 3, 2}, std::greater<int>()) == 3, "");
+    static_assert(std::min({2, 1, 3}, std::greater<int>()) == 3, "");
+    static_assert(std::min({3, 2, 1}, std::greater<int>()) == 3, "");
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<LessThanComparable T>
+//   pair<const T&, const T&>
+//   minmax(const T& a, const T& b);
+
+#include <algorithm>
+#include <cassert>
+
+template <class T>
+void
+test(const T& a, const T& b, const T& x, const T& y)
+{
+    std::pair<const T&, const T&> p = std::minmax(a, b);
+    assert(&p.first == &x);
+    assert(&p.second == &y);
+}
+
+int main()
+{
+    {
+    int x = 0;
+    int y = 0;
+    test(x, y, x, y);
+    test(y, x, y, x);
+    }
+    {
+    int x = 0;
+    int y = 1;
+    test(x, y, x, y);
+    test(y, x, x, y);
+    }
+    {
+    int x = 1;
+    int y = 0;
+    test(x, y, y, x);
+    test(y, x, y, x);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+//  Note that you can't take a reference to a local var, since 
+//  its address is not a compile-time constant.
+    constexpr static int x = 1;
+    constexpr static int y = 0;
+    constexpr auto p1 = std::minmax (x, y);
+    static_assert(p1.first  == y, "");
+    static_assert(p1.second == x, "");
+    constexpr auto p2 = std::minmax (y, x);
+    static_assert(p2.first  == y, "");
+    static_assert(p2.second == x, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T, StrictWeakOrder<auto, T> Compare>
+//   requires !SameType<T, Compare> && CopyConstructible<Compare>
+//   pair<const T&, const T&>
+//   minmax(const T& a, const T& b, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+template <class T, class C>
+void
+test(const T& a, const T& b, C c, const T& x, const T& y)
+{
+    std::pair<const T&, const T&> p = std::minmax(a, b, c);
+    assert(&p.first == &x);
+    assert(&p.second == &y);
+}
+
+
+int main()
+{
+    {
+    int x = 0;
+    int y = 0;
+    test(x, y, std::greater<int>(), x, y);
+    test(y, x, std::greater<int>(), y, x);
+    }
+    {
+    int x = 0;
+    int y = 1;
+    test(x, y, std::greater<int>(), y, x);
+    test(y, x, std::greater<int>(), y, x);
+    }
+    {
+    int x = 1;
+    int y = 0;
+    test(x, y, std::greater<int>(), x, y);
+    test(y, x, std::greater<int>(), x, y);
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+//  Note that you can't take a reference to a local var, since 
+//  its address is not a compile-time constant.
+    constexpr static int x = 1;
+    constexpr static int y = 0;
+    constexpr auto p1 = std::minmax(x, y, std::greater<>());
+    static_assert(p1.first  == x, "");
+    static_assert(p1.second == y, "");
+    constexpr auto p2 = std::minmax(y, x, std::greater<>());
+    static_assert(p2.first  == x, "");
+    static_assert(p2.second == y, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter>
+//   requires LessThanComparable<Iter::value_type>
+//   pair<Iter, Iter>
+//   minmax_element(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last)
+{
+    std::pair<Iter, Iter> p = std::minmax_element(first, last);
+    if (first != last)
+    {
+        for (Iter j = first; j != last; ++j)
+        {
+            assert(!(*j < *p.first));
+            assert(!(*p.second < *j));
+        }
+    }
+    else
+    {
+        assert(p.first == last);
+        assert(p.second == last);
+    }
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = i;
+    std::random_shuffle(a, a+N);
+    test(Iter(a), Iter(a+N));
+    delete [] a;
+}
+
+template <class Iter>
+void
+test()
+{
+    test<Iter>(0);
+    test<Iter>(1);
+    test<Iter>(2);
+    test<Iter>(3);
+    test<Iter>(10);
+    test<Iter>(1000);
+    {
+    const unsigned N = 100;
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = 5;
+    std::random_shuffle(a, a+N);
+    std::pair<Iter, Iter> p = std::minmax_element(Iter(a), Iter(a+N));
+    assert(base(p.first) == a);
+    assert(base(p.second) == a+N-1);
+    delete [] a;
+    }
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires CopyConstructible<Compare>
+//   pair<Iter, Iter>
+//   minmax_element(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last)
+{
+    typedef std::greater<int> Compare;
+    Compare comp;
+    std::pair<Iter, Iter> p = std::minmax_element(first, last, comp);
+    if (first != last)
+    {
+        for (Iter j = first; j != last; ++j)
+        {
+            assert(!comp(*j, *p.first));
+            assert(!comp(*p.second, *j));
+        }
+    }
+    else
+    {
+        assert(p.first == last);
+        assert(p.second == last);
+    }
+}
+
+template <class Iter>
+void
+test(unsigned N)
+{
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = i;
+    std::random_shuffle(a, a+N);
+    test(Iter(a), Iter(a+N));
+    delete [] a;
+}
+
+template <class Iter>
+void
+test()
+{
+    test<Iter>(0);
+    test<Iter>(1);
+    test<Iter>(2);
+    test<Iter>(3);
+    test<Iter>(10);
+    test<Iter>(1000);
+    {
+    const unsigned N = 100;
+    int* a = new int[N];
+    for (int i = 0; i < N; ++i)
+        a[i] = 5;
+    std::random_shuffle(a, a+N);
+    typedef std::greater<int> Compare;
+    Compare comp;
+    std::pair<Iter, Iter> p = std::minmax_element(Iter(a), Iter(a+N), comp);
+    assert(base(p.first) == a);
+    assert(base(p.second) == a+N-1);
+    delete [] a;
+    }
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T>
+//   pair<T, T>
+//   minmax(initializer_list<T> t);
+
+#include <algorithm>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
+    assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)));
+    assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)));
+    assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)));
+    assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)));
+    assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)));
+#if _LIBCPP_STD_VER > 11
+    {
+    static_assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)), "");
+    static_assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)), "");
+    static_assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)), "");
+    static_assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)), "");
+    static_assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)), "");
+    static_assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)), "");
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class T, class Compare>
+//   pair<T, T>
+//   minmax(initializer_list<T> t, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
+    assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
+    assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
+    assert((std::minmax({2, 3, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
+    assert((std::minmax({3, 1, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
+    assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)));
+#if _LIBCPP_STD_VER > 11
+    {
+    static_assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
+    static_assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
+    static_assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
+    static_assert((std::minmax({2, 3, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
+    static_assert((std::minmax({3, 1, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
+    static_assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   void
+//   nth_element(Iter first, Iter nth, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+void
+test_one(unsigned N, unsigned M)
+{
+    assert(N != 0);
+    assert(M < N);
+    int* array = new int[N];
+    for (int i = 0; i < N; ++i)
+        array[i] = i;
+    std::random_shuffle(array, array+N);
+    std::nth_element(array, array+M, array+N);
+    assert(array[M] == M);
+    std::nth_element(array, array+N, array+N); // begin, end, end
+    delete [] array;
+}
+
+void
+test(unsigned N)
+{
+    test_one(N, 0);
+    test_one(N, 1);
+    test_one(N, 2);
+    test_one(N, 3);
+    test_one(N, N/2-1);
+    test_one(N, N/2);
+    test_one(N, N/2+1);
+    test_one(N, N-3);
+    test_one(N, N-2);
+    test_one(N, N-1);
+}
+
+int main()
+{
+    int d = 0;
+    std::nth_element(&d, &d, &d);
+    assert(d == 0);
+    test(256);
+    test(257);
+    test(499);
+    test(500);
+    test(997);
+    test(1000);
+    test(1009);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter>
+//         && CopyConstructible<Compare>
+//   void
+//   nth_element(Iter first, Iter nth, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <vector>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+void
+test_one(unsigned N, unsigned M)
+{
+    assert(N != 0);
+    assert(M < N);
+    int* array = new int[N];
+    for (int i = 0; i < N; ++i)
+        array[i] = i;
+    std::random_shuffle(array, array+N);
+    std::nth_element(array, array+M, array+N, std::greater<int>());
+    assert(array[M] == N-M-1);
+    std::nth_element(array, array+N, array+N, std::greater<int>()); // begin, end, end
+    delete [] array;
+}
+
+void
+test(unsigned N)
+{
+    test_one(N, 0);
+    test_one(N, 1);
+    test_one(N, 2);
+    test_one(N, 3);
+    test_one(N, N/2-1);
+    test_one(N, N/2);
+    test_one(N, N/2+1);
+    test_one(N, N-3);
+    test_one(N, N-2);
+    test_one(N, N-1);
+}
+
+int main()
+{
+    int d = 0;
+    std::nth_element(&d, &d, &d);
+    assert(d == 0);
+    test(256);
+    test(257);
+    test(499);
+    test(500);
+    test(997);
+    test(1000);
+    test(1009);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::vector<std::unique_ptr<int> > v(1000);
+    for (int i = 0; i < v.size(); ++i)
+        v[i].reset(new int(i));
+    std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
+    assert(*v[v.size()/2] == v.size()/2);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<BidirectionalIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   bool
+//   next_permutation(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+#include <cstdio>
+
+int factorial(int x)
+{
+    int r = 1;
+    for (; x; --x)
+        r *= x;
+    return r;
+}
+
+template <class Iter>
+void
+test()
+{
+    int ia[] = {1, 2, 3, 4, 5, 6};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int prev[sa];
+    for (int e = 0; e <= sa; ++e)
+    {
+        int count = 0;
+        bool x;
+        do
+        {
+            std::copy(ia, ia+e, prev);
+            x = std::next_permutation(Iter(ia), Iter(ia+e));
+            if (e > 1)
+            {
+                if (x)
+                    assert(std::lexicographical_compare(prev, prev+e, ia, ia+e));
+                else
+                    assert(std::lexicographical_compare(ia, ia+e, prev, prev+e));
+            }
+            ++count;
+        } while (x);
+        assert(count == factorial(e));
+    }
+}
+
+int main()
+{
+    test<bidirectional_iterator<int*> >();
+    test<random_access_iterator<int*> >();
+    test<int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/next_permutation_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<BidirectionalIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter>
+//         && CopyConstructible<Compare>
+//   bool
+//   next_permutation(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+#include <cstdio>
+
+int factorial(int x)
+{
+    int r = 1;
+    for (; x; --x)
+        r *= x;
+    return r;
+}
+
+template <class Iter>
+void
+test()
+{
+    typedef std::greater<int> C;
+    int ia[] = {6, 5, 4, 3, 2, 1};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int prev[sa];
+    for (int e = 0; e <= sa; ++e)
+    {
+        int count = 0;
+        bool x;
+        do
+        {
+            std::copy(ia, ia+e, prev);
+            x = std::next_permutation(Iter(ia), Iter(ia+e), C());
+            if (e > 1)
+            {
+                if (x)
+                    assert(std::lexicographical_compare(prev, prev+e, ia, ia+e, C()));
+                else
+                    assert(std::lexicographical_compare(ia, ia+e, prev, prev+e, C()));
+            }
+            ++count;
+        } while (x);
+        assert(count == factorial(e));
+    }
+}
+
+int main()
+{
+    test<bidirectional_iterator<int*> >();
+    test<random_access_iterator<int*> >();
+    test<int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<BidirectionalIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   bool
+//   prev_permutation(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+#include <cstdio>
+
+int factorial(int x)
+{
+    int r = 1;
+    for (; x; --x)
+        r *= x;
+    return r;
+}
+
+template <class Iter>
+void
+test()
+{
+    int ia[] = {6, 5, 4, 3, 2, 1};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int prev[sa];
+    for (int e = 0; e <= sa; ++e)
+    {
+        int count = 0;
+        bool x;
+        do
+        {
+            std::copy(ia, ia+e, prev);
+            x = std::prev_permutation(Iter(ia), Iter(ia+e));
+            if (e > 1)
+            {
+                if (x)
+                    assert(std::lexicographical_compare(ia, ia+e, prev, prev+e));
+                else
+                    assert(std::lexicographical_compare(prev, prev+e, ia, ia+e));
+            }
+            ++count;
+        } while (x);
+        assert(count == factorial(e));
+    }
+}
+
+int main()
+{
+    test<bidirectional_iterator<int*> >();
+    test<random_access_iterator<int*> >();
+    test<int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.permutation.generators/prev_permutation_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<BidirectionalIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter>
+//         && CopyConstructible<Compare>
+//   bool
+//   prev_permutation(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+#include <cstdio>
+
+int factorial(int x)
+{
+    int r = 1;
+    for (; x; --x)
+        r *= x;
+    return r;
+}
+
+template <class Iter>
+void
+test()
+{
+    typedef std::greater<int> C;
+    int ia[] = {1, 2, 3, 4, 5, 6};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int prev[sa];
+    for (int e = 0; e <= sa; ++e)
+    {
+        int count = 0;
+        bool x;
+        do
+        {
+            std::copy(ia, ia+e, prev);
+            x = std::prev_permutation(Iter(ia), Iter(ia+e), C());
+            if (e > 1)
+            {
+                if (x)
+                    assert(std::lexicographical_compare(ia, ia+e, prev, prev+e, C()));
+                else
+                    assert(std::lexicographical_compare(prev, prev+e, ia, ia+e, C()));
+            }
+            ++count;
+        } while (x);
+        assert(count == factorial(e));
+    }
+}
+
+int main()
+{
+    test<bidirectional_iterator<int*> >();
+    test<random_access_iterator<int*> >();
+    test<int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator Iter1, InputIterator Iter2>
+//   requires HasLess<Iter1::value_type, Iter2::value_type>
+//         && HasLess<Iter2::value_type, Iter1::value_type>
+//   bool
+//   includes(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4};
+    const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[] = {1, 2};
+    const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+    int id[] = {3, 3, 3, 3};
+    const unsigned sd = sizeof(id)/sizeof(id[0]);
+
+    assert(std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib)));
+    assert(!std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib+1)));
+    assert(std::includes(Iter1(ia), Iter1(ia+1), Iter2(ib), Iter2(ib)));
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa)));
+
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(ib), Iter2(ib+sb)));
+    assert(!std::includes(Iter1(ib), Iter1(ib+sb), Iter2(ia), Iter2(ia+sa)));
+
+    assert(std::includes(Iter1(ia), Iter1(ia+2), Iter2(ic), Iter2(ic+2)));
+    assert(!std::includes(Iter1(ia), Iter1(ia+2), Iter2(ib), Iter2(ib+2)));
+
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+1)));
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+2)));
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+3)));
+    assert(!std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+4)));
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*> >();
+    test<input_iterator<const int*>, const int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+    test<forward_iterator<const int*>, const int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, const int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+    test<random_access_iterator<const int*>, const int*>();
+
+    test<const int*, input_iterator<const int*> >();
+    test<const int*, forward_iterator<const int*> >();
+    test<const int*, bidirectional_iterator<const int*> >();
+    test<const int*, random_access_iterator<const int*> >();
+    test<const int*, const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator Iter1, InputIterator Iter2, typename Compare>
+//   requires Predicate<Compare, Iter1::value_type, Iter2::value_type>
+//         && Predicate<Compare, Iter2::value_type, Iter1::value_type>
+//   bool
+//   includes(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4};
+    const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[] = {1, 2};
+    const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+    int id[] = {3, 3, 3, 3};
+    const unsigned sd = sizeof(id)/sizeof(id[0]);
+
+    assert(std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib), std::less<int>()));
+    assert(!std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib+1), std::less<int>()));
+    assert(std::includes(Iter1(ia), Iter1(ia+1), Iter2(ib), Iter2(ib), std::less<int>()));
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), std::less<int>()));
+
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(ib), Iter2(ib+sb), std::less<int>()));
+    assert(!std::includes(Iter1(ib), Iter1(ib+sb), Iter2(ia), Iter2(ia+sa), std::less<int>()));
+
+    assert(std::includes(Iter1(ia), Iter1(ia+2), Iter2(ic), Iter2(ic+2), std::less<int>()));
+    assert(!std::includes(Iter1(ia), Iter1(ia+2), Iter2(ib), Iter2(ib+2), std::less<int>()));
+
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+1), std::less<int>()));
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+2), std::less<int>()));
+    assert(std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+3), std::less<int>()));
+    assert(!std::includes(Iter1(ia), Iter1(ia+sa), Iter2(id), Iter2(id+4), std::less<int>()));
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*> >();
+    test<input_iterator<const int*>, const int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+    test<forward_iterator<const int*>, const int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+    test<bidirectional_iterator<const int*>, const int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+    test<random_access_iterator<const int*>, const int*>();
+
+    test<const int*, input_iterator<const int*> >();
+    test<const int*, forward_iterator<const int*> >();
+    test<const int*, bidirectional_iterator<const int*> >();
+    test<const int*, random_access_iterator<const int*> >();
+    test<const int*, const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/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/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,200 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && HasLess<InIter2::value_type, InIter1::value_type>
+//         && HasLess<InIter1::value_type, InIter2::value_type>
+//   OutIter
+//   set_difference(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2,
+//                  OutIter result);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {1, 2, 3, 3, 3, 4, 4};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_difference(Iter1(ia), Iter1(ia+sa),
+                                     Iter2(ib), Iter2(ib+sb), OutIter(ic));
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    int irr[] = {6};
+    const int srr = sizeof(irr)/sizeof(irr[0]);
+    ce = std::set_difference(Iter1(ib), Iter1(ib+sb),
+                             Iter2(ia), Iter2(ia+sa), OutIter(ic));
+    assert(base(ce) - ic == srr);
+    assert(std::lexicographical_compare(ic, base(ce), irr, irr+srr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.difference/set_difference_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,202 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
+//          CopyConstructible Compare>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && Predicate<Compare, InIter1::value_type, InIter2::value_type>
+//         && Predicate<Compare, InIter2::value_type, InIter1::value_type>
+//   OutIter
+//   set_difference(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2,
+//                  OutIter result, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {1, 2, 3, 3, 3, 4, 4};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_difference(Iter1(ia), Iter1(ia+sa),
+                                     Iter2(ib), Iter2(ib+sb), OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    int irr[] = {6};
+    const int srr = sizeof(irr)/sizeof(irr[0]);
+    ce = std::set_difference(Iter1(ib), Iter1(ib+sb),
+                             Iter2(ia), Iter2(ia+sa), OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == srr);
+    assert(std::lexicographical_compare(ic, base(ce), irr, irr+srr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,198 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && HasLess<InIter2::value_type, InIter1::value_type>
+//         && HasLess<InIter1::value_type, InIter2::value_type>
+//   OutIter
+//   set_intersection(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2,
+//                    OutIter result);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {2, 4, 4};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_intersection(Iter1(ia), Iter1(ia+sa),
+                                       Iter2(ib), Iter2(ib+sb), OutIter(ic));
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    ce = std::set_intersection(Iter1(ib), Iter1(ib+sb),
+                               Iter2(ia), Iter2(ia+sa), OutIter(ic));
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,200 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
+//          CopyConstructible Compare>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && Predicate<Compare, InIter1::value_type, InIter2::value_type>
+//         && Predicate<Compare, InIter2::value_type, InIter1::value_type>
+//   OutIter
+//   set_intersection(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2,
+//                    OutIter result, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {2, 4, 4};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_intersection(Iter1(ia), Iter1(ia+sa),
+                                       Iter2(ib), Iter2(ib+sb), OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    ce = std::set_intersection(Iter1(ib), Iter1(ib+sb),
+                               Iter2(ia), Iter2(ia+sa), OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && HasLess<InIter2::value_type, InIter1::value_type>
+//         && HasLess<InIter1::value_type, InIter2::value_type>
+//   OutIter
+//   set_symmetric_difference(InIter1 first1, InIter1 last1,
+//                            InIter2 first2, InIter2 last2,
+//                            OutIter result);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {1, 2, 3, 3, 3, 4, 4, 6};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_symmetric_difference(Iter1(ia), Iter1(ia+sa),
+                                               Iter2(ib), Iter2(ib+sb), OutIter(ic));
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    ce = std::set_symmetric_difference(Iter1(ib), Iter1(ib+sb),
+                                       Iter2(ia), Iter2(ia+sa), OutIter(ic));
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.symmetric.difference/set_symmetric_difference_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
+//          CopyConstructible Compare>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && Predicate<Compare, InIter1::value_type, InIter2::value_type>
+//         && Predicate<Compare, InIter2::value_type, InIter1::value_type>
+//   OutIter
+//   set_symmetric_difference(InIter1 first1, InIter1 last1,
+//                            InIter2 first2, InIter2 last2,
+//                            OutIter result, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {1, 2, 3, 3, 3, 4, 4, 6};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_symmetric_difference(Iter1(ia), Iter1(ia+sa),
+                                               Iter2(ib), Iter2(ib+sb),
+                                               OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    ce = std::set_symmetric_difference(Iter1(ib), Iter1(ib+sb),
+                                       Iter2(ia), Iter2(ia+sa),
+                                       OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,198 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && HasLess<InIter2::value_type, InIter1::value_type>
+//         && HasLess<InIter1::value_type, InIter2::value_type>
+//   OutIter
+//   set_union(InIter1 first1, InIter1 last1,
+//             InIter2 first2, InIter2 last2, OutIter result);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 6};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_union(Iter1(ia), Iter1(ia+sa),
+                                Iter2(ib), Iter2(ib+sb), OutIter(ic));
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    ce = std::set_union(Iter1(ib), Iter1(ib+sb),
+                        Iter2(ia), Iter2(ia+sa), OutIter(ic));
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,200 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
+//          CopyConstructible Compare>
+//   requires OutputIterator<OutIter, InIter1::reference>
+//         && OutputIterator<OutIter, InIter2::reference>
+//         && Predicate<Compare, InIter1::value_type, InIter2::value_type>
+//         && Predicate<Compare, InIter2::value_type, InIter1::value_type>
+//   OutIter
+//   set_union(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2,
+//             OutIter result, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class OutIter>
+void
+test()
+{
+    int ia[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
+    const int sa = sizeof(ia)/sizeof(ia[0]);
+    int ib[] = {2, 4, 4, 6};
+    const int sb = sizeof(ib)/sizeof(ib[0]);
+    int ic[20];
+    int ir[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 6};
+    const int sr = sizeof(ir)/sizeof(ir[0]);
+    OutIter ce = std::set_union(Iter1(ia), Iter1(ia+sa),
+                                Iter2(ib), Iter2(ib+sb), OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+    ce = std::set_union(Iter1(ib), Iter1(ib+sb),
+                        Iter2(ia), Iter2(ia+sa), OutIter(ic), std::less<int>());
+    assert(base(ce) - ic == sr);
+    assert(std::lexicographical_compare(ic, base(ce), ir, ir+sr) == 0);
+}
+
+int main()
+{
+    test<input_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<input_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<input_iterator<const int*>, const int*, int*>();
+
+    test<forward_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<forward_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<forward_iterator<const int*>, const int*, int*>();
+
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<bidirectional_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<bidirectional_iterator<const int*>, const int*, int*>();
+
+    test<random_access_iterator<const int*>, input_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, input_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, forward_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, bidirectional_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, random_access_iterator<const int*>, int*>();
+
+    test<random_access_iterator<const int*>, const int*, output_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, forward_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, bidirectional_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, random_access_iterator<int*> >();
+    test<random_access_iterator<const int*>, const int*, int*>();
+
+    test<const int*, input_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, input_iterator<const int*>, int*>();
+
+    test<const int*, forward_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, forward_iterator<const int*>, int*>();
+
+    test<const int*, bidirectional_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, bidirectional_iterator<const int*>, int*>();
+
+    test<const int*, random_access_iterator<const int*>, output_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, forward_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, bidirectional_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, random_access_iterator<int*> >();
+    test<const int*, random_access_iterator<const int*>, int*>();
+
+    test<const int*, const int*, output_iterator<int*> >();
+    test<const int*, const int*, forward_iterator<int*> >();
+    test<const int*, const int*, bidirectional_iterator<int*> >();
+    test<const int*, const int*, random_access_iterator<int*> >();
+    test<const int*, const int*, int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,183 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter>
+//   requires LessThanComparable<Iter::value_type>
+//   bool
+//   is_sorted(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test()
+{
+    {
+    int a[] = {0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a)));
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+
+    {
+    int a[] = {0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+
+    {
+    int a[] = {0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+
+    {
+    int a[] = {0, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {0, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+    {
+    int a[] = {1, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa)));
+    }
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,184 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires CopyConstructible<Compare>
+//   bool
+//   is_sorted(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test()
+{
+    {
+    int a[] = {0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a)));
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+
+    {
+    int a[] = {0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+
+    {
+    int a[] = {0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+
+    {
+    int a[] = {0, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {0, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(!std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+    {
+    int a[] = {1, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted(Iter(a), Iter(a+sa), std::greater<int>()));
+    }
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,183 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter>
+//   requires LessThanComparable<Iter::value_type>
+//   Iter
+//   is_sorted_until(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test()
+{
+    {
+    int a[] = {0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a)) == Iter(a));
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+
+    {
+    int a[] = {0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+
+    {
+    int a[] = {0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+2));
+    }
+    {
+    int a[] = {0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+2));
+    }
+    {
+    int a[] = {1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+
+    {
+    int a[] = {0, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+3));
+    }
+    {
+    int a[] = {0, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+2));
+    }
+    {
+    int a[] = {0, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+2));
+    }
+    {
+    int a[] = {0, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+3));
+    }
+    {
+    int a[] = {0, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+2));
+    }
+    {
+    int a[] = {1, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+2));
+    }
+    {
+    int a[] = {1, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+3));
+    }
+    {
+    int a[] = {1, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa)) == Iter(a+sa));
+    }
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/is.sorted/is_sorted_until_comp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,184 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires CopyConstructible<Compare>
+//   Iter
+//   is_sorted_until(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test()
+{
+    {
+    int a[] = {0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a), std::greater<int>()) == Iter(a));
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+
+    {
+    int a[] = {0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+
+    {
+    int a[] = {0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+2));
+    }
+    {
+    int a[] = {0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+1));
+    }
+    {
+    int a[] = {0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+2));
+    }
+    {
+    int a[] = {1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+
+    {
+    int a[] = {0, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {0, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+3));
+    }
+    {
+    int a[] = {0, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+2));
+    }
+    {
+    int a[] = {0, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+2));
+    }
+    {
+    int a[] = {0, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+1));
+    }
+    {
+    int a[] = {0, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+1));
+    }
+    {
+    int a[] = {0, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+1));
+    }
+    {
+    int a[] = {0, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+1));
+    }
+    {
+    int a[] = {1, 0, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 0, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+3));
+    }
+    {
+    int a[] = {1, 0, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+2));
+    }
+    {
+    int a[] = {1, 0, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+2));
+    }
+    {
+    int a[] = {1, 1, 0, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 1, 0, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+3));
+    }
+    {
+    int a[] = {1, 1, 1, 0};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+    {
+    int a[] = {1, 1, 1, 1};
+    unsigned sa = sizeof(a) / sizeof(a[0]);
+    assert(std::is_sorted_until(Iter(a), Iter(a+sa), std::greater<int>()) == Iter(a+sa));
+    }
+}
+
+int main()
+{
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/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/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter, RandomAccessIterator RAIter>
+//   requires ShuffleIterator<RAIter>
+//         && OutputIterator<RAIter, InIter::reference>
+//         && HasLess<InIter::value_type, RAIter::value_type>
+//         && LessThanComparable<RAIter::value_type>
+//   RAIter
+//   partial_sort_copy(InIter first, InIter last, RAIter result_first, RAIter result_last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test_larger_sorts(unsigned N, unsigned M)
+{
+    int* input = new int[N];
+    int* output = new int[M];
+    for (int i = 0; i < N; ++i)
+        input[i] = i;
+    std::random_shuffle(input, input+N);
+    int* r = std::partial_sort_copy(Iter(input), Iter(input+N), output, output+M);
+    int* e = output + std::min(N, M);
+    assert(r == e);
+    int i = 0;
+    for (int* x = output; x < e; ++x, ++i)
+        assert(*x == i);
+    delete [] output;
+    delete [] input;
+}
+
+template <class Iter>
+void
+test_larger_sorts(unsigned N)
+{
+    test_larger_sorts<Iter>(N, 0);
+    test_larger_sorts<Iter>(N, 1);
+    test_larger_sorts<Iter>(N, 2);
+    test_larger_sorts<Iter>(N, 3);
+    test_larger_sorts<Iter>(N, N/2-1);
+    test_larger_sorts<Iter>(N, N/2);
+    test_larger_sorts<Iter>(N, N/2+1);
+    test_larger_sorts<Iter>(N, N-2);
+    test_larger_sorts<Iter>(N, N-1);
+    test_larger_sorts<Iter>(N, N);
+    test_larger_sorts<Iter>(N, N+1000);
+}
+
+template <class Iter>
+void
+test()
+{
+    test_larger_sorts<Iter>(0, 100);
+    test_larger_sorts<Iter>(10);
+    test_larger_sorts<Iter>(256);
+    test_larger_sorts<Iter>(257);
+    test_larger_sorts<Iter>(499);
+    test_larger_sorts<Iter>(500);
+    test_larger_sorts<Iter>(997);
+    test_larger_sorts<Iter>(1000);
+    test_larger_sorts<Iter>(1009);
+}
+
+int main()
+{
+    int i = 0;
+    std::partial_sort_copy(&i, &i, &i, &i+5);
+    assert(i == 0);
+    test<input_iterator<const int*> >();
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<InputIterator InIter, RandomAccessIterator RAIter, class Compare>
+//   requires ShuffleIterator<RAIter>
+//         && OutputIterator<RAIter, InIter::reference>
+//         && Predicate<Compare, InIter::value_type, RAIter::value_type>
+//         && StrictWeakOrder<Compare, RAIter::value_type>}
+//         && CopyConstructible<Compare>
+//   RAIter
+//   partial_sort_copy(InIter first, InIter last,
+//                     RAIter result_first, RAIter result_last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter>
+void
+test_larger_sorts(unsigned N, unsigned M)
+{
+    int* input = new int[N];
+    int* output = new int[M];
+    for (int i = 0; i < N; ++i)
+        input[i] = i;
+    std::random_shuffle(input, input+N);
+    int* r = std::partial_sort_copy(Iter(input), Iter(input+N), output, output+M,
+                                    std::greater<int>());
+    int* e = output + std::min(N, M);
+    assert(r == e);
+    int i = 0;
+    for (int* x = output; x < e; ++x, ++i)
+        assert(*x == N-i-1);
+    delete [] output;
+    delete [] input;
+}
+
+template <class Iter>
+void
+test_larger_sorts(unsigned N)
+{
+    test_larger_sorts<Iter>(N, 0);
+    test_larger_sorts<Iter>(N, 1);
+    test_larger_sorts<Iter>(N, 2);
+    test_larger_sorts<Iter>(N, 3);
+    test_larger_sorts<Iter>(N, N/2-1);
+    test_larger_sorts<Iter>(N, N/2);
+    test_larger_sorts<Iter>(N, N/2+1);
+    test_larger_sorts<Iter>(N, N-2);
+    test_larger_sorts<Iter>(N, N-1);
+    test_larger_sorts<Iter>(N, N);
+    test_larger_sorts<Iter>(N, N+1000);
+}
+
+template <class Iter>
+void
+test()
+{
+    test_larger_sorts<Iter>(0, 100);
+    test_larger_sorts<Iter>(10);
+    test_larger_sorts<Iter>(256);
+    test_larger_sorts<Iter>(257);
+    test_larger_sorts<Iter>(499);
+    test_larger_sorts<Iter>(500);
+    test_larger_sorts<Iter>(997);
+    test_larger_sorts<Iter>(1000);
+    test_larger_sorts<Iter>(1009);
+}
+
+int main()
+{
+    int i = 0;
+    std::partial_sort_copy(&i, &i, &i, &i+5);
+    assert(i == 0);
+    test<input_iterator<const int*> >();
+    test<forward_iterator<const int*> >();
+    test<bidirectional_iterator<const int*> >();
+    test<random_access_iterator<const int*> >();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   void
+//   partial_sort(Iter first, Iter middle, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+void
+test_larger_sorts(unsigned N, unsigned M)
+{
+    assert(N != 0);
+    int* array = new int[N];
+    for (int i = 0; i < N; ++i)
+        array[i] = i;
+    std::random_shuffle(array, array+N);
+    std::partial_sort(array, array+M, array+N);
+    for (int i = 0; i < M; ++i)
+        assert(array[i] == i);
+    delete [] array;
+}
+
+void
+test_larger_sorts(unsigned N)
+{
+    test_larger_sorts(N, 0);
+    test_larger_sorts(N, 1);
+    test_larger_sorts(N, 2);
+    test_larger_sorts(N, 3);
+    test_larger_sorts(N, N/2-1);
+    test_larger_sorts(N, N/2);
+    test_larger_sorts(N, N/2+1);
+    test_larger_sorts(N, N-2);
+    test_larger_sorts(N, N-1);
+    test_larger_sorts(N, N);
+}
+
+int main()
+{
+    int i = 0;
+    std::partial_sort(&i, &i, &i);
+    assert(i == 0);
+    test_larger_sorts(10);
+    test_larger_sorts(256);
+    test_larger_sorts(257);
+    test_larger_sorts(499);
+    test_larger_sorts(500);
+    test_larger_sorts(997);
+    test_larger_sorts(1000);
+    test_larger_sorts(1009);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter>
+//         && CopyConstructible<Compare>
+//   void
+//   partial_sort(Iter first, Iter middle, Iter last, Compare comp);
+
+#include <algorithm>
+#include <vector>
+#include <functional>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+void
+test_larger_sorts(unsigned N, unsigned M)
+{
+    assert(N != 0);
+    int* array = new int[N];
+    for (int i = 0; i < N; ++i)
+        array[i] = i;
+    std::random_shuffle(array, array+N);
+    std::partial_sort(array, array+M, array+N, std::greater<int>());
+    for (int i = 0; i < M; ++i)
+        assert(array[i] == N-i-1);
+    delete [] array;
+}
+
+void
+test_larger_sorts(unsigned N)
+{
+    test_larger_sorts(N, 0);
+    test_larger_sorts(N, 1);
+    test_larger_sorts(N, 2);
+    test_larger_sorts(N, 3);
+    test_larger_sorts(N, N/2-1);
+    test_larger_sorts(N, N/2);
+    test_larger_sorts(N, N/2+1);
+    test_larger_sorts(N, N-2);
+    test_larger_sorts(N, N-1);
+    test_larger_sorts(N, N);
+}
+
+int main()
+{
+    int i = 0;
+    std::partial_sort(&i, &i, &i);
+    assert(i == 0);
+    test_larger_sorts(10);
+    test_larger_sorts(256);
+    test_larger_sorts(257);
+    test_larger_sorts(499);
+    test_larger_sorts(500);
+    test_larger_sorts(997);
+    test_larger_sorts(1000);
+    test_larger_sorts(1009);
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::vector<std::unique_ptr<int> > v(1000);
+    for (int i = 0; i < v.size(); ++i)
+        v[i].reset(new int(i));
+    std::partial_sort(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
+    for (int i = 0; i < v.size()/2; ++i)
+        assert(*v[i] == i);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,150 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   void
+//   sort(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+template <class RI>
+void
+test_sort_helper(RI f, RI l)
+{
+    typedef typename std::iterator_traits<RI>::value_type value_type;
+    if (f != l)
+    {
+        long len = l - f;
+        value_type* save(new value_type[len]);
+        do
+        {
+            std::copy(f, l, save);
+            std::sort(save, save+len);
+            assert(std::is_sorted(save, save+len));
+        } while (std::next_permutation(f, l));
+        delete [] save;
+    }
+}
+
+template <class RI>
+void
+test_sort_driver_driver(RI f, RI l, int start, RI real_last)
+{
+    for (RI i = l; i > f + start;)
+    {
+        *--i = start;
+        if (f == i)
+        {
+            test_sort_helper(f, real_last);
+        }
+    if (start > 0)
+        test_sort_driver_driver(f, i, start-1, real_last);
+    }
+}
+
+template <class RI>
+void
+test_sort_driver(RI f, RI l, int start)
+{
+    test_sort_driver_driver(f, l, start, l);
+}
+
+template <unsigned sa>
+void
+test_sort_()
+{
+    int ia[sa];
+    for (int i = 0; i < sa; ++i)
+    {
+        test_sort_driver(ia, ia+sa, i);
+    }
+}
+
+void
+test_larger_sorts(unsigned N, unsigned M)
+{
+    assert(N != 0);
+    assert(M != 0);
+    // create array length N filled with M different numbers
+    int* array = new int[N];
+    int x = 0;
+    for (int i = 0; i < N; ++i)
+    {
+        array[i] = x;
+        if (++x == M)
+            x = 0;
+    }
+    // test saw tooth pattern
+    std::sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test random pattern
+    std::random_shuffle(array, array+N);
+    std::sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test sorted pattern
+    std::sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test reverse sorted pattern
+    std::reverse(array, array+N);
+    std::sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test swap ranges 2 pattern
+    std::swap_ranges(array, array+N/2, array+N/2);
+    std::sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test reverse swap ranges 2 pattern
+    std::reverse(array, array+N);
+    std::swap_ranges(array, array+N/2, array+N/2);
+    std::sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    delete [] array;
+}
+
+void
+test_larger_sorts(unsigned N)
+{
+    test_larger_sorts(N, 1);
+    test_larger_sorts(N, 2);
+    test_larger_sorts(N, 3);
+    test_larger_sorts(N, N/2-1);
+    test_larger_sorts(N, N/2);
+    test_larger_sorts(N, N/2+1);
+    test_larger_sorts(N, N-2);
+    test_larger_sorts(N, N-1);
+    test_larger_sorts(N, N);
+}
+
+int main()
+{
+    // test null range
+    int d = 0;
+    std::sort(&d, &d);
+    // exhaustively test all possibilities up to length 8
+    test_sort_<1>();
+    test_sort_<2>();
+    test_sort_<3>();
+    test_sort_<4>();
+    test_sort_<5>();
+    test_sort_<6>();
+    test_sort_<7>();
+    test_sort_<8>();
+
+    test_larger_sorts(256);
+    test_larger_sorts(257);
+    test_larger_sorts(499);
+    test_larger_sorts(500);
+    test_larger_sorts(997);
+    test_larger_sorts(1000);
+    test_larger_sorts(1009);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter>
+//         && CopyConstructible<Compare>
+//   void
+//   sort(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <vector>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+    {
+    std::vector<int> v(1000);
+    for (int i = 0; i < v.size(); ++i)
+        v[i] = i;
+    std::sort(v.begin(), v.end(), std::greater<int>());
+    std::reverse(v.begin(), v.end());
+    assert(std::is_sorted(v.begin(), v.end()));
+    }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::vector<std::unique_ptr<int> > v(1000);
+    for (int i = 0; i < v.size(); ++i)
+        v[i].reset(new int(i));
+    std::sort(v.begin(), v.end(), indirect_less());
+    assert(std::is_sorted(v.begin(), v.end(), indirect_less()));
+    assert(*v[0] == 0);
+    assert(*v[1] == 1);
+    assert(*v[2] == 2);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,150 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter>
+//   requires ShuffleIterator<Iter>
+//         && LessThanComparable<Iter::value_type>
+//   void
+//   stable_sort(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+template <class RI>
+void
+test_sort_helper(RI f, RI l)
+{
+    typedef typename std::iterator_traits<RI>::value_type value_type;
+    if (f != l)
+    {
+        long len = l - f;
+        value_type* save(new value_type[len]);
+        do
+        {
+            std::copy(f, l, save);
+            std::stable_sort(save, save+len);
+            assert(std::is_sorted(save, save+len));
+        } while (std::next_permutation(f, l));
+        delete [] save;
+    }
+}
+
+template <class RI>
+void
+test_sort_driver_driver(RI f, RI l, int start, RI real_last)
+{
+    for (RI i = l; i > f + start;)
+    {
+        *--i = start;
+        if (f == i)
+        {
+            test_sort_helper(f, real_last);
+        }
+    if (start > 0)
+        test_sort_driver_driver(f, i, start-1, real_last);
+    }
+}
+
+template <class RI>
+void
+test_sort_driver(RI f, RI l, int start)
+{
+    test_sort_driver_driver(f, l, start, l);
+}
+
+template <unsigned sa>
+void
+test_sort_()
+{
+    int ia[sa];
+    for (int i = 0; i < sa; ++i)
+    {
+        test_sort_driver(ia, ia+sa, i);
+    }
+}
+
+void
+test_larger_sorts(unsigned N, unsigned M)
+{
+    assert(N != 0);
+    assert(M != 0);
+    // create array length N filled with M different numbers
+    int* array = new int[N];
+    int x = 0;
+    for (int i = 0; i < N; ++i)
+    {
+        array[i] = x;
+        if (++x == M)
+            x = 0;
+    }
+    // test saw tooth pattern
+    std::stable_sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test random pattern
+    std::random_shuffle(array, array+N);
+    std::stable_sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test sorted pattern
+    std::stable_sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test reverse sorted pattern
+    std::reverse(array, array+N);
+    std::stable_sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test swap ranges 2 pattern
+    std::swap_ranges(array, array+N/2, array+N/2);
+    std::stable_sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    // test reverse swap ranges 2 pattern
+    std::reverse(array, array+N);
+    std::swap_ranges(array, array+N/2, array+N/2);
+    std::stable_sort(array, array+N);
+    assert(std::is_sorted(array, array+N));
+    delete [] array;
+}
+
+void
+test_larger_sorts(unsigned N)
+{
+    test_larger_sorts(N, 1);
+    test_larger_sorts(N, 2);
+    test_larger_sorts(N, 3);
+    test_larger_sorts(N, N/2-1);
+    test_larger_sorts(N, N/2);
+    test_larger_sorts(N, N/2+1);
+    test_larger_sorts(N, N-2);
+    test_larger_sorts(N, N-1);
+    test_larger_sorts(N, N);
+}
+
+int main()
+{
+    // test null range
+    int d = 0;
+    std::stable_sort(&d, &d);
+    // exhaustively test all possibilities up to length 8
+    test_sort_<1>();
+    test_sort_<2>();
+    test_sort_<3>();
+    test_sort_<4>();
+    test_sort_<5>();
+    test_sort_<6>();
+    test_sort_<7>();
+    test_sort_<8>();
+
+    test_larger_sorts(256);
+    test_larger_sorts(257);
+    test_larger_sorts(499);
+    test_larger_sorts(500);
+    test_larger_sorts(997);
+    test_larger_sorts(1000);
+    test_larger_sorts(1009);
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
+//   requires ShuffleIterator<Iter>
+//         && CopyConstructible<Compare>
+//   void
+//   stable_sort(Iter first, Iter last, Compare comp);
+
+#include <algorithm>
+#include <functional>
+#include <vector>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+
+struct indirect_less
+{
+    template <class P>
+    bool operator()(const P& x, const P& y)
+        {return *x < *y;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+struct first_only
+{
+    bool operator()(const std::pair<int, int>& x, const std::pair<int, int>& y)
+    {
+        return x.first < y.first;
+    }
+};
+
+void test()
+{
+    typedef std::pair<int, int> P;
+    const int N = 1000;
+    const int M = 10;
+    std::vector<P> v(N);
+    int x = 0;
+    int ver = 0;
+    for (int i = 0; i < N; ++i)
+    {
+        v[i] = P(x, ver);
+        if (++x == M)
+        {
+            x = 0;
+            ++ver;
+        }
+    }
+    for (int i = 0; i < N - M; i += M)
+    {
+        std::random_shuffle(v.begin() + i, v.begin() + i + M);
+    }
+    std::stable_sort(v.begin(), v.end(), first_only());
+    assert(std::is_sorted(v.begin(), v.end()));
+}
+
+int main()
+{
+    test();
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    std::vector<std::unique_ptr<int> > v(1000);
+    for (int i = 0; i < v.size(); ++i)
+        v[i].reset(new int(i));
+    std::stable_sort(v.begin(), v.end(), indirect_less());
+    assert(std::is_sorted(v.begin(), v.end(), indirect_less()));
+    assert(*v[0] == 0);
+    assert(*v[1] == 1);
+    assert(*v[2] == 2);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/algorithms/alg.sorting/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/alg.sorting/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/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/algorithms/algorithms.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/algorithms.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/algorithms.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/algorithms.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/algorithms/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/algorithms/version.pass.cpp (added)
+++ libcxx/trunk/test/std/algorithms/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+#include <algorithm>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/atomics/atomics.fences/atomic_signal_fence.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.fences/atomic_signal_fence.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.fences/atomic_signal_fence.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.fences/atomic_signal_fence.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// void atomic_signal_fence(memory_order m);
+
+#include <atomic>
+
+int main()
+{
+    std::atomic_signal_fence(std::memory_order_seq_cst);
+}

Added: libcxx/trunk/test/std/atomics/atomics.fences/atomic_thread_fence.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.fences/atomic_thread_fence.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.fences/atomic_thread_fence.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.fences/atomic_thread_fence.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// void atomic_thread_fence(memory_order m);
+
+#include <atomic>
+
+int main()
+{
+    std::atomic_thread_fence(std::memory_order_seq_cst);
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// void atomic_flag_clear(volatile atomic_flag*);
+// void atomic_flag_clear(atomic_flag*);
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear(&f);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear(&f);
+        assert(f.test_and_set() == 0);
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order);
+// void atomic_flag_clear_explicit(atomic_flag*, memory_order);
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear_explicit(&f, std::memory_order_release);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear_explicit(&f, std::memory_order_release);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
+        assert(f.test_and_set() == 0);
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// bool atomic_flag_test_and_set(volatile atomic_flag*);
+// bool atomic_flag_test_and_set(atomic_flag*);
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set(&f) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set(&f) == 0);
+        assert(f.test_and_set() == 1);
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_test_and_set_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order);
+// bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order);
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_relaxed) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_consume) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_acquire) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_release) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_acq_rel) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_seq_cst) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_relaxed) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_consume) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_acquire) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_release) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_acq_rel) == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(atomic_flag_test_and_set_explicit(&f, std::memory_order_seq_cst) == 0);
+        assert(f.test_and_set() == 1);
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/clear.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// void clear(memory_order = memory_order_seq_cst);
+// void clear(memory_order = memory_order_seq_cst) volatile;
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        f.clear();
+        assert(f.test_and_set() == 0);
+    }
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        f.clear(std::memory_order_relaxed);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        f.clear(std::memory_order_release);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        std::atomic_flag f;
+        f.test_and_set();
+        f.clear(std::memory_order_seq_cst);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        f.clear();
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        f.clear(std::memory_order_relaxed);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        f.clear(std::memory_order_release);
+        assert(f.test_and_set() == 0);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.test_and_set();
+        f.clear(std::memory_order_seq_cst);
+        assert(f.test_and_set() == 0);
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/copy_assign.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/copy_assign.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/copy_assign.fail.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/copy_assign.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// struct atomic_flag
+
+// atomic_flag& operator=(const atomic_flag&) = delete;
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    std::atomic_flag f0;
+    std::atomic_flag f;
+    f = f0;
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/copy_ctor.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/copy_ctor.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/copy_ctor.fail.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/copy_ctor.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// struct atomic_flag
+
+// atomic_flag(const atomic_flag&) = delete;
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    std::atomic_flag f0;
+    std::atomic_flag f(f0);
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/copy_volatile_assign.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/copy_volatile_assign.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/copy_volatile_assign.fail.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/copy_volatile_assign.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// struct atomic_flag
+
+// atomic_flag& operator=(const atomic_flag&) = delete;
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    std::atomic_flag f0;
+    volatile std::atomic_flag f;
+    f = f0;
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/default.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/default.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// atomic_flag() = default;
+
+#include <atomic>
+#include <new>
+#include <cassert>
+
+int main()
+{
+    std::atomic_flag f;
+
+    {
+        typedef std::atomic_flag A;
+        _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
+        A& zero = *new (storage) A();
+        assert(!zero.test_and_set());
+        zero.~A();
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/init.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/init.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/init.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// atomic_flag() = ATOMIC_FLAG_INIT;
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    std::atomic_flag f = ATOMIC_FLAG_INIT;
+    assert(f.test_and_set() == 0);
+}

Added: libcxx/trunk/test/std/atomics/atomics.flag/test_and_set.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.flag/test_and_set.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.flag/test_and_set.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.flag/test_and_set.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// struct atomic_flag
+
+// bool test_and_set(memory_order = memory_order_seq_cst);
+// bool test_and_set(memory_order = memory_order_seq_cst) volatile;
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set() == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_relaxed) == 0);
+        assert(f.test_and_set(std::memory_order_relaxed) == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_consume) == 0);
+        assert(f.test_and_set(std::memory_order_consume) == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_acquire) == 0);
+        assert(f.test_and_set(std::memory_order_acquire) == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_release) == 0);
+        assert(f.test_and_set(std::memory_order_release) == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_acq_rel) == 0);
+        assert(f.test_and_set(std::memory_order_acq_rel) == 1);
+    }
+    {
+        std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_seq_cst) == 0);
+        assert(f.test_and_set(std::memory_order_seq_cst) == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set() == 0);
+        assert(f.test_and_set() == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_relaxed) == 0);
+        assert(f.test_and_set(std::memory_order_relaxed) == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_consume) == 0);
+        assert(f.test_and_set(std::memory_order_consume) == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_acquire) == 0);
+        assert(f.test_and_set(std::memory_order_acquire) == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_release) == 0);
+        assert(f.test_and_set(std::memory_order_release) == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_acq_rel) == 0);
+        assert(f.test_and_set(std::memory_order_acq_rel) == 1);
+    }
+    {
+        volatile std::atomic_flag f;
+        f.clear();
+        assert(f.test_and_set(std::memory_order_seq_cst) == 0);
+        assert(f.test_and_set(std::memory_order_seq_cst) == 1);
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.general/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The 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/atomics/atomics.lockfree/lockfree.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// #define ATOMIC_CHAR_LOCK_FREE unspecified
+// #define ATOMIC_CHAR16_T_LOCK_FREE unspecified
+// #define ATOMIC_CHAR32_T_LOCK_FREE unspecified
+// #define ATOMIC_WCHAR_T_LOCK_FREE unspecified
+// #define ATOMIC_SHORT_LOCK_FREE unspecified
+// #define ATOMIC_INT_LOCK_FREE unspecified
+// #define ATOMIC_LONG_LOCK_FREE unspecified
+// #define ATOMIC_LLONG_LOCK_FREE unspecified
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    assert(ATOMIC_CHAR_LOCK_FREE == 0 ||
+           ATOMIC_CHAR_LOCK_FREE == 1 ||
+           ATOMIC_CHAR_LOCK_FREE == 2);
+    assert(ATOMIC_CHAR16_T_LOCK_FREE == 0 ||
+           ATOMIC_CHAR16_T_LOCK_FREE == 1 ||
+           ATOMIC_CHAR16_T_LOCK_FREE == 2);
+    assert(ATOMIC_CHAR32_T_LOCK_FREE == 0 ||
+           ATOMIC_CHAR32_T_LOCK_FREE == 1 ||
+           ATOMIC_CHAR32_T_LOCK_FREE == 2);
+    assert(ATOMIC_WCHAR_T_LOCK_FREE == 0 ||
+           ATOMIC_WCHAR_T_LOCK_FREE == 1 ||
+           ATOMIC_WCHAR_T_LOCK_FREE == 2);
+    assert(ATOMIC_SHORT_LOCK_FREE == 0 ||
+           ATOMIC_SHORT_LOCK_FREE == 1 ||
+           ATOMIC_SHORT_LOCK_FREE == 2);
+    assert(ATOMIC_INT_LOCK_FREE == 0 ||
+           ATOMIC_INT_LOCK_FREE == 1 ||
+           ATOMIC_INT_LOCK_FREE == 2);
+    assert(ATOMIC_LONG_LOCK_FREE == 0 ||
+           ATOMIC_LONG_LOCK_FREE == 1 ||
+           ATOMIC_LONG_LOCK_FREE == 2);
+    assert(ATOMIC_LLONG_LOCK_FREE == 0 ||
+           ATOMIC_LLONG_LOCK_FREE == 1 ||
+           ATOMIC_LLONG_LOCK_FREE == 2);
+}

Added: libcxx/trunk/test/std/atomics/atomics.order/kill_dependency.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.order/kill_dependency.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.order/kill_dependency.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.order/kill_dependency.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class T> T kill_dependency(T y);
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    assert(std::kill_dependency(5) == 5);
+    assert(std::kill_dependency(-5.5) == -5.5);
+}

Added: libcxx/trunk/test/std/atomics/atomics.order/memory_order.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.order/memory_order.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.order/memory_order.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.order/memory_order.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// typedef enum memory_order
+// {
+//     memory_order_relaxed, memory_order_consume, memory_order_acquire,
+//     memory_order_release, memory_order_acq_rel, memory_order_seq_cst
+// } memory_order;
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+    assert(std::memory_order_relaxed == 0);
+    assert(std::memory_order_consume == 1);
+    assert(std::memory_order_acquire == 2);
+    assert(std::memory_order_release == 3);
+    assert(std::memory_order_acq_rel == 4);
+    assert(std::memory_order_seq_cst == 5);
+    std::memory_order o = std::memory_order_seq_cst;
+    assert(o == 5);
+}

Added: libcxx/trunk/test/std/atomics/atomics.syn/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.syn/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.syn/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.syn/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The 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/atomics/atomics.types.generic/address.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/address.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/address.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/address.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test case crashes clang.
+
+// <atomic>
+
+// template <class T>
+// struct atomic<T*>
+// {
+//     bool is_lock_free() const volatile;
+//     bool is_lock_free() const;
+//     void store(T* desr, memory_order m = memory_order_seq_cst) volatile;
+//     void store(T* desr, memory_order m = memory_order_seq_cst);
+//     T* load(memory_order m = memory_order_seq_cst) const volatile;
+//     T* load(memory_order m = memory_order_seq_cst) const;
+//     operator T*() const volatile;
+//     operator T*() const;
+//     T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile;
+//     T* exchange(T* desr, memory_order m = memory_order_seq_cst);
+//     bool compare_exchange_weak(T*& expc, T* desr,
+//                                memory_order s, memory_order f) volatile;
+//     bool compare_exchange_weak(T*& expc, T* desr,
+//                                memory_order s, memory_order f);
+//     bool compare_exchange_strong(T*& expc, T* desr,
+//                                  memory_order s, memory_order f) volatile;
+//     bool compare_exchange_strong(T*& expc, T* desr,
+//                                  memory_order s, memory_order f);
+//     bool compare_exchange_weak(T*& expc, T* desr,
+//                                memory_order m = memory_order_seq_cst) volatile;
+//     bool compare_exchange_weak(T*& expc, T* desr,
+//                                memory_order m = memory_order_seq_cst);
+//     bool compare_exchange_strong(T*& expc, T* desr,
+//                                 memory_order m = memory_order_seq_cst) volatile;
+//     bool compare_exchange_strong(T*& expc, T* desr,
+//                                  memory_order m = memory_order_seq_cst);
+//     T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
+//     T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst);
+//     T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
+//     T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst);
+// 
+//     atomic() = default;
+//     constexpr atomic(T* desr);
+//     atomic(const atomic&) = delete;
+//     atomic& operator=(const atomic&) = delete;
+//     atomic& operator=(const atomic&) volatile = delete;
+// 
+//     T* operator=(T*) volatile;
+//     T* operator=(T*);
+//     T* operator++(int) volatile;
+//     T* operator++(int);
+//     T* operator--(int) volatile;
+//     T* operator--(int);
+//     T* operator++() volatile;
+//     T* operator++();
+//     T* operator--() volatile;
+//     T* operator--();
+//     T* operator+=(ptrdiff_t op) volatile;
+//     T* operator+=(ptrdiff_t op);
+//     T* operator-=(ptrdiff_t op) volatile;
+//     T* operator-=(ptrdiff_t op);
+// };
+
+#include <atomic>
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+#include <cmpxchg_loop.h>
+
+template <class A, class T>
+void
+do_test()
+{
+    typedef typename std::remove_pointer<T>::type X;
+    A obj(T(0));
+    assert(obj == T(0));
+    std::atomic_init(&obj, T(1));
+    assert(obj == T(1));
+    std::atomic_init(&obj, T(2));
+    assert(obj == T(2));
+    bool b0 = obj.is_lock_free();
+    obj.store(T(0));
+    assert(obj == T(0));
+    obj.store(T(1), std::memory_order_release);
+    assert(obj == T(1));
+    assert(obj.load() == T(1));
+    assert(obj.load(std::memory_order_acquire) == T(1));
+    assert(obj.exchange(T(2)) == T(1));
+    assert(obj == T(2));
+    assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
+    assert(obj == T(3));
+    T x = obj;
+    assert(cmpxchg_weak_loop(obj, x, T(2)) == true);
+    assert(obj == T(2));
+    assert(x == T(3));
+    assert(obj.compare_exchange_weak(x, T(1)) == false);
+    assert(obj == T(2));
+    assert(x == T(2));
+    x = T(2);
+    assert(obj.compare_exchange_strong(x, T(1)) == true);
+    assert(obj == T(1));
+    assert(x == T(2));
+    assert(obj.compare_exchange_strong(x, T(0)) == false);
+    assert(obj == T(1));
+    assert(x == T(1));
+    assert((obj = T(0)) == T(0));
+    assert(obj == T(0));
+    obj = T(2*sizeof(X));
+    assert((obj += std::ptrdiff_t(3)) == T(5*sizeof(X)));
+    assert(obj == T(5*sizeof(X)));
+    assert((obj -= std::ptrdiff_t(3)) == T(2*sizeof(X)));
+    assert(obj == T(2*sizeof(X)));
+
+    {
+        _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
+        A& zero = *new (storage) A();    
+        assert(zero == 0);
+        zero.~A();
+    }
+}
+
+template <class A, class T>
+void test()
+{
+    do_test<A, T>();
+    do_test<volatile A, T>();
+}
+
+int main()
+{
+    test<std::atomic<int*>, int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/bool.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,237 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class T>
+// struct atomic
+// {
+//     bool is_lock_free() const volatile;
+//     bool is_lock_free() const;
+//     void store(T desr, memory_order m = memory_order_seq_cst) volatile;
+//     void store(T desr, memory_order m = memory_order_seq_cst);
+//     T load(memory_order m = memory_order_seq_cst) const volatile;
+//     T load(memory_order m = memory_order_seq_cst) const;
+//     operator T() const volatile;
+//     operator T() const;
+//     T exchange(T desr, memory_order m = memory_order_seq_cst) volatile;
+//     T exchange(T desr, memory_order m = memory_order_seq_cst);
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order s, memory_order f) volatile;
+//     bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f);
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order s, memory_order f) volatile;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order s, memory_order f);
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order m = memory_order_seq_cst) volatile;
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order m = memory_order_seq_cst);
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                 memory_order m = memory_order_seq_cst) volatile;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order m = memory_order_seq_cst);
+// 
+//     atomic() = default;
+//     constexpr atomic(T desr);
+//     atomic(const atomic&) = delete;
+//     atomic& operator=(const atomic&) = delete;
+//     atomic& operator=(const atomic&) volatile = delete;
+//     T operator=(T) volatile;
+//     T operator=(T);
+// };
+//
+// typedef atomic<bool> atomic_bool;
+
+#include <atomic>
+#include <new>
+#include <cassert>
+
+#include <cmpxchg_loop.h>
+
+int main()
+{
+    {
+        volatile std::atomic<bool> _;
+        volatile std::atomic<bool> obj(true);
+        assert(obj == true);
+        std::atomic_init(&obj, false);
+        assert(obj == false);
+        std::atomic_init(&obj, true);
+        assert(obj == true);
+        bool b0 = obj.is_lock_free();
+        (void)b0; // to placate scan-build
+        obj.store(false);
+        assert(obj == false);
+        obj.store(true, std::memory_order_release);
+        assert(obj == true);
+        assert(obj.load() == true);
+        assert(obj.load(std::memory_order_acquire) == true);
+        assert(obj.exchange(false) == true);
+        assert(obj == false);
+        assert(obj.exchange(true, std::memory_order_relaxed) == false);
+        assert(obj == true);
+        bool x = obj;
+        assert(cmpxchg_weak_loop(obj, x, false) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert(obj.compare_exchange_weak(x, true,
+                                         std::memory_order_seq_cst) == false);
+        assert(obj == false);
+        assert(x == false);
+        obj.store(true);
+        x = true;
+        assert(cmpxchg_weak_loop(obj, x, false,
+                                 std::memory_order_seq_cst,
+                                 std::memory_order_seq_cst) == true);
+        assert(obj == false);
+        assert(x == true);
+        x = true;
+        obj.store(true);
+        assert(obj.compare_exchange_strong(x, false) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert(obj.compare_exchange_strong(x, true,
+                                         std::memory_order_seq_cst) == false);
+        assert(obj == false);
+        assert(x == false);
+        x = true;
+        obj.store(true);
+        assert(obj.compare_exchange_strong(x, false,
+                                           std::memory_order_seq_cst,
+                                           std::memory_order_seq_cst) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert((obj = false) == false);
+        assert(obj == false);
+        assert((obj = true) == true);
+        assert(obj == true);
+    }
+    {
+        std::atomic<bool> _;
+        std::atomic<bool> obj(true);
+        assert(obj == true);
+        std::atomic_init(&obj, false);
+        assert(obj == false);
+        std::atomic_init(&obj, true);
+        assert(obj == true);
+        bool b0 = obj.is_lock_free();
+        (void)b0; // to placate scan-build
+        obj.store(false);
+        assert(obj == false);
+        obj.store(true, std::memory_order_release);
+        assert(obj == true);
+        assert(obj.load() == true);
+        assert(obj.load(std::memory_order_acquire) == true);
+        assert(obj.exchange(false) == true);
+        assert(obj == false);
+        assert(obj.exchange(true, std::memory_order_relaxed) == false);
+        assert(obj == true);
+        bool x = obj;
+        assert(cmpxchg_weak_loop(obj, x, false) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert(obj.compare_exchange_weak(x, true,
+                                         std::memory_order_seq_cst) == false);
+        assert(obj == false);
+        assert(x == false);
+        obj.store(true);
+        x = true;
+        assert(cmpxchg_weak_loop(obj, x, false,
+                                 std::memory_order_seq_cst,
+                                 std::memory_order_seq_cst) == true);
+        assert(obj == false);
+        assert(x == true);
+        x = true;
+        obj.store(true);
+        assert(obj.compare_exchange_strong(x, false) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert(obj.compare_exchange_strong(x, true,
+                                         std::memory_order_seq_cst) == false);
+        assert(obj == false);
+        assert(x == false);
+        x = true;
+        obj.store(true);
+        assert(obj.compare_exchange_strong(x, false,
+                                           std::memory_order_seq_cst,
+                                           std::memory_order_seq_cst) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert((obj = false) == false);
+        assert(obj == false);
+        assert((obj = true) == true);
+        assert(obj == true);
+    }
+    {
+        std::atomic_bool _;
+        std::atomic_bool obj(true);
+        assert(obj == true);
+        std::atomic_init(&obj, false);
+        assert(obj == false);
+        std::atomic_init(&obj, true);
+        assert(obj == true);
+        bool b0 = obj.is_lock_free();
+        (void)b0; // to placate scan-build
+        obj.store(false);
+        assert(obj == false);
+        obj.store(true, std::memory_order_release);
+        assert(obj == true);
+        assert(obj.load() == true);
+        assert(obj.load(std::memory_order_acquire) == true);
+        assert(obj.exchange(false) == true);
+        assert(obj == false);
+        assert(obj.exchange(true, std::memory_order_relaxed) == false);
+        assert(obj == true);
+        bool x = obj;
+        assert(cmpxchg_weak_loop(obj, x, false) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert(obj.compare_exchange_weak(x, true,
+                                         std::memory_order_seq_cst) == false);
+        assert(obj == false);
+        assert(x == false);
+        obj.store(true);
+        x = true;
+        assert(cmpxchg_weak_loop(obj, x, false,
+                                 std::memory_order_seq_cst,
+                                 std::memory_order_seq_cst) == true);
+        assert(obj == false);
+        assert(x == true);
+        x = true;
+        obj.store(true);
+        assert(obj.compare_exchange_strong(x, false) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert(obj.compare_exchange_strong(x, true,
+                                         std::memory_order_seq_cst) == false);
+        assert(obj == false);
+        assert(x == false);
+        x = true;
+        obj.store(true);
+        assert(obj.compare_exchange_strong(x, false,
+                                           std::memory_order_seq_cst,
+                                           std::memory_order_seq_cst) == true);
+        assert(obj == false);
+        assert(x == true);
+        assert((obj = false) == false);
+        assert(obj == false);
+        assert((obj = true) == true);
+        assert(obj == true);
+    }
+    {
+        typedef std::atomic<bool> A;
+        _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
+        A& zero = *new (storage) A();    
+        assert(zero == false);
+        zero.~A();
+    }
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/cstdint_typedefs.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// typedef atomic<int_least8_t>   atomic_int_least8_t;
+// typedef atomic<uint_least8_t>  atomic_uint_least8_t;
+// typedef atomic<int_least16_t>  atomic_int_least16_t;
+// typedef atomic<uint_least16_t> atomic_uint_least16_t;
+// typedef atomic<int_least32_t>  atomic_int_least32_t;
+// typedef atomic<uint_least32_t> atomic_uint_least32_t;
+// typedef atomic<int_least64_t>  atomic_int_least64_t;
+// typedef atomic<uint_least64_t> atomic_uint_least64_t;
+// 
+// typedef atomic<int_fast8_t>   atomic_int_fast8_t;
+// typedef atomic<uint_fast8_t>  atomic_uint_fast8_t;
+// typedef atomic<int_fast16_t>  atomic_int_fast16_t;
+// typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
+// typedef atomic<int_fast32_t>  atomic_int_fast32_t;
+// typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
+// typedef atomic<int_fast64_t>  atomic_int_fast64_t;
+// typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
+// 
+// typedef atomic<intptr_t>  atomic_intptr_t;
+// typedef atomic<uintptr_t> atomic_uintptr_t;
+// typedef atomic<size_t>    atomic_size_t;
+// typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
+// typedef atomic<intmax_t>  atomic_intmax_t;
+// typedef atomic<uintmax_t> atomic_uintmax_t;
+
+#include <atomic>
+#include <type_traits>
+#include <cstdint>
+
+int main()
+{
+    static_assert((std::is_same<std::atomic<  std::int_least8_t>,   std::atomic_int_least8_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::uint_least8_t>,  std::atomic_uint_least8_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::int_least16_t>,  std::atomic_int_least16_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uint_least16_t>, std::atomic_uint_least16_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::int_least32_t>,  std::atomic_int_least32_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uint_least32_t>, std::atomic_uint_least32_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::int_least64_t>,  std::atomic_int_least64_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uint_least64_t>, std::atomic_uint_least64_t>::value), "");
+
+    static_assert((std::is_same<std::atomic<  std::int_fast8_t>,   std::atomic_int_fast8_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::uint_fast8_t>,  std::atomic_uint_fast8_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::int_fast16_t>,  std::atomic_int_fast16_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uint_fast16_t>, std::atomic_uint_fast16_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::int_fast32_t>,  std::atomic_int_fast32_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uint_fast32_t>, std::atomic_uint_fast32_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::int_fast64_t>,  std::atomic_int_fast64_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uint_fast64_t>, std::atomic_uint_fast64_t>::value), "");
+
+    static_assert((std::is_same<std::atomic< std::intptr_t>,  std::atomic_intptr_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uintptr_t>, std::atomic_uintptr_t>::value), "");
+    static_assert((std::is_same<std::atomic<   std::size_t>,    std::atomic_size_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::ptrdiff_t>, std::atomic_ptrdiff_t>::value), "");
+    static_assert((std::is_same<std::atomic< std::intmax_t>,  std::atomic_intmax_t>::value), "");
+    static_assert((std::is_same<std::atomic<std::uintmax_t>, std::atomic_uintmax_t>::value), "");
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/integral.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <>
+// struct atomic<integral>
+// {
+//     bool is_lock_free() const volatile;
+//     bool is_lock_free() const;
+//     void store(integral desr, memory_order m = memory_order_seq_cst) volatile;
+//     void store(integral desr, memory_order m = memory_order_seq_cst);
+//     integral load(memory_order m = memory_order_seq_cst) const volatile;
+//     integral load(memory_order m = memory_order_seq_cst) const;
+//     operator integral() const volatile;
+//     operator integral() const;
+//     integral exchange(integral desr,
+//                       memory_order m = memory_order_seq_cst) volatile;
+//     integral exchange(integral desr, memory_order m = memory_order_seq_cst);
+//     bool compare_exchange_weak(integral& expc, integral desr,
+//                                memory_order s, memory_order f) volatile;
+//     bool compare_exchange_weak(integral& expc, integral desr,
+//                                memory_order s, memory_order f);
+//     bool compare_exchange_strong(integral& expc, integral desr,
+//                                  memory_order s, memory_order f) volatile;
+//     bool compare_exchange_strong(integral& expc, integral desr,
+//                                  memory_order s, memory_order f);
+//     bool compare_exchange_weak(integral& expc, integral desr,
+//                                memory_order m = memory_order_seq_cst) volatile;
+//     bool compare_exchange_weak(integral& expc, integral desr,
+//                                memory_order m = memory_order_seq_cst);
+//     bool compare_exchange_strong(integral& expc, integral desr,
+//                                 memory_order m = memory_order_seq_cst) volatile;
+//     bool compare_exchange_strong(integral& expc, integral desr,
+//                                  memory_order m = memory_order_seq_cst);
+// 
+//     integral
+//         fetch_add(integral op, memory_order m = memory_order_seq_cst) volatile;
+//     integral fetch_add(integral op, memory_order m = memory_order_seq_cst);
+//     integral
+//         fetch_sub(integral op, memory_order m = memory_order_seq_cst) volatile;
+//     integral fetch_sub(integral op, memory_order m = memory_order_seq_cst);
+//     integral
+//         fetch_and(integral op, memory_order m = memory_order_seq_cst) volatile;
+//     integral fetch_and(integral op, memory_order m = memory_order_seq_cst);
+//     integral
+//         fetch_or(integral op, memory_order m = memory_order_seq_cst) volatile;
+//     integral fetch_or(integral op, memory_order m = memory_order_seq_cst);
+//     integral
+//         fetch_xor(integral op, memory_order m = memory_order_seq_cst) volatile;
+//     integral fetch_xor(integral op, memory_order m = memory_order_seq_cst);
+// 
+//     atomic() = default;
+//     constexpr atomic(integral desr);
+//     atomic(const atomic&) = delete;
+//     atomic& operator=(const atomic&) = delete;
+//     atomic& operator=(const atomic&) volatile = delete;
+//     integral operator=(integral desr) volatile;
+//     integral operator=(integral desr);
+// 
+//     integral operator++(int) volatile;
+//     integral operator++(int);
+//     integral operator--(int) volatile;
+//     integral operator--(int);
+//     integral operator++() volatile;
+//     integral operator++();
+//     integral operator--() volatile;
+//     integral operator--();
+//     integral operator+=(integral op) volatile;
+//     integral operator+=(integral op);
+//     integral operator-=(integral op) volatile;
+//     integral operator-=(integral op);
+//     integral operator&=(integral op) volatile;
+//     integral operator&=(integral op);
+//     integral operator|=(integral op) volatile;
+//     integral operator|=(integral op);
+//     integral operator^=(integral op) volatile;
+//     integral operator^=(integral op);
+// };
+
+#include <atomic>
+#include <new>
+#include <cassert>
+
+#include <cmpxchg_loop.h>
+
+template <class A, class T>
+void
+do_test()
+{
+    A obj(T(0));
+    assert(obj == T(0));
+    std::atomic_init(&obj, T(1));
+    assert(obj == T(1));
+    std::atomic_init(&obj, T(2));
+    assert(obj == T(2));
+    bool b0 = obj.is_lock_free();
+    obj.store(T(0));
+    assert(obj == T(0));
+    obj.store(T(1), std::memory_order_release);
+    assert(obj == T(1));
+    assert(obj.load() == T(1));
+    assert(obj.load(std::memory_order_acquire) == T(1));
+    assert(obj.exchange(T(2)) == T(1));
+    assert(obj == T(2));
+    assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
+    assert(obj == T(3));
+    T x = obj;
+    assert(cmpxchg_weak_loop(obj, x, T(2)) == true);
+    assert(obj == T(2));
+    assert(x == T(3));
+    assert(obj.compare_exchange_weak(x, T(1)) == false);
+    assert(obj == T(2));
+    assert(x == T(2));
+    x = T(2);
+    assert(obj.compare_exchange_strong(x, T(1)) == true);
+    assert(obj == T(1));
+    assert(x == T(2));
+    assert(obj.compare_exchange_strong(x, T(0)) == false);
+    assert(obj == T(1));
+    assert(x == T(1));
+    assert((obj = T(0)) == T(0));
+    assert(obj == T(0));
+    assert(obj++ == T(0));
+    assert(obj == T(1));
+    assert(++obj == T(2));
+    assert(obj == T(2));
+    assert(--obj == T(1));
+    assert(obj == T(1));
+    assert(obj-- == T(1));
+    assert(obj == T(0));
+    obj = T(2);
+    assert((obj += T(3)) == T(5));
+    assert(obj == T(5));
+    assert((obj -= T(3)) == T(2));
+    assert(obj == T(2));
+    assert((obj |= T(5)) == T(7));
+    assert(obj == T(7));
+    assert((obj &= T(0xF)) == T(7));
+    assert(obj == T(7));
+    assert((obj ^= T(0xF)) == T(8));
+    assert(obj == T(8));
+
+    {
+        _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
+        A& zero = *new (storage) A();    
+        assert(zero == 0);
+        zero.~A();
+    }
+}
+
+template <class A, class T>
+void test()
+{
+    do_test<A, T>();
+    do_test<volatile A, T>();
+}
+
+
+int main()
+{
+    test<std::atomic_char, char>();
+    test<std::atomic_schar, signed char>();
+    test<std::atomic_uchar, unsigned char>();
+    test<std::atomic_short, short>();
+    test<std::atomic_ushort, unsigned short>();
+    test<std::atomic_int, int>();
+    test<std::atomic_uint, unsigned int>();
+    test<std::atomic_long, long>();
+    test<std::atomic_ulong, unsigned long>();
+    test<std::atomic_llong, long long>();
+    test<std::atomic_ullong, unsigned long long>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<std::atomic_char16_t, char16_t>();
+    test<std::atomic_char32_t, char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<std::atomic_wchar_t, wchar_t>();
+
+    test<volatile std::atomic_char, char>();
+    test<volatile std::atomic_schar, signed char>();
+    test<volatile std::atomic_uchar, unsigned char>();
+    test<volatile std::atomic_short, short>();
+    test<volatile std::atomic_ushort, unsigned short>();
+    test<volatile std::atomic_int, int>();
+    test<volatile std::atomic_uint, unsigned int>();
+    test<volatile std::atomic_long, long>();
+    test<volatile std::atomic_ulong, unsigned long>();
+    test<volatile std::atomic_llong, long long>();
+    test<volatile std::atomic_ullong, unsigned long long>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<volatile std::atomic_char16_t, char16_t>();
+    test<volatile std::atomic_char32_t, char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<volatile std::atomic_wchar_t, wchar_t>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// typedef atomic<char>               atomic_char;
+// typedef atomic<signed char>        atomic_schar;
+// typedef atomic<unsigned char>      atomic_uchar;
+// typedef atomic<short>              atomic_short;
+// typedef atomic<unsigned short>     atomic_ushort;
+// typedef atomic<int>                atomic_int;
+// typedef atomic<unsigned int>       atomic_uint;
+// typedef atomic<long>               atomic_long;
+// typedef atomic<unsigned long>      atomic_ulong;
+// typedef atomic<long long>          atomic_llong;
+// typedef atomic<unsigned long long> atomic_ullong;
+// typedef atomic<char16_t>           atomic_char16_t;
+// typedef atomic<char32_t>           atomic_char32_t;
+// typedef atomic<wchar_t>            atomic_wchar_t;
+
+#include <atomic>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::atomic<char>, std::atomic_char>::value), "");
+    static_assert((std::is_same<std::atomic<signed char>, std::atomic_schar>::value), "");
+    static_assert((std::is_same<std::atomic<unsigned char>, std::atomic_uchar>::value), "");
+    static_assert((std::is_same<std::atomic<short>, std::atomic_short>::value), "");
+    static_assert((std::is_same<std::atomic<unsigned short>, std::atomic_ushort>::value), "");
+    static_assert((std::is_same<std::atomic<int>, std::atomic_int>::value), "");
+    static_assert((std::is_same<std::atomic<unsigned int>, std::atomic_uint>::value), "");
+    static_assert((std::is_same<std::atomic<long>, std::atomic_long>::value), "");
+    static_assert((std::is_same<std::atomic<unsigned long>, std::atomic_ulong>::value), "");
+    static_assert((std::is_same<std::atomic<long long>, std::atomic_llong>::value), "");
+    static_assert((std::is_same<std::atomic<unsigned long long>, std::atomic_ullong>::value), "");
+    static_assert((std::is_same<std::atomic<wchar_t>, std::atomic_wchar_t>::value), "");
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
+    static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// template <class T>
+// struct atomic
+// {
+//     bool is_lock_free() const volatile noexcept;
+//     bool is_lock_free() const noexcept;
+//     void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+//     void store(T desr, memory_order m = memory_order_seq_cst) noexcept;
+//     T load(memory_order m = memory_order_seq_cst) const volatile noexcept;
+//     T load(memory_order m = memory_order_seq_cst) const noexcept;
+//     operator T() const volatile noexcept;
+//     operator T() const noexcept;
+//     T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+//     T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept;
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order s, memory_order f) volatile noexcept;
+//     bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order s, memory_order f) volatile noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order s, memory_order f) noexcept;
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order m = memory_order_seq_cst) volatile noexcept;
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order m = memory_order_seq_cst) noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                 memory_order m = memory_order_seq_cst) volatile noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order m = memory_order_seq_cst) noexcept;
+// 
+//     atomic() noexcept = default;
+//     constexpr atomic(T desr) noexcept;
+//     atomic(const atomic&) = delete;
+//     atomic& operator=(const atomic&) = delete;
+//     atomic& operator=(const atomic&) volatile = delete;
+//     T operator=(T) volatile noexcept;
+//     T operator=(T) noexcept;
+// };
+
+#include <atomic>
+#include <new>
+#include <cassert>
+#include <thread> // for thread_id
+#include <chrono> // for nanoseconds
+
+struct NotTriviallyCopyable {
+    NotTriviallyCopyable ( int i ) : i_(i) {}
+    NotTriviallyCopyable ( const NotTriviallyCopyable &rhs) : i_(rhs.i_) {}
+    int i_;
+    };
+
+template <class T>
+void test ( T t ) {
+    std::atomic<T> t0(t);
+    }
+
+int main()
+{
+    test(NotTriviallyCopyable(42));
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/trivially_copyable.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// NOTE: atomic<> of a TriviallyCopyable class is wrongly rejected by older
+// clang versions. It was fixed right before the llvm 3.5 release. See PR18097.
+// XFAIL: apple-clang-6.0, clang-3.4, clang-3.3
+
+// <atomic>
+
+// template <class T>
+// struct atomic
+// {
+//     bool is_lock_free() const volatile noexcept;
+//     bool is_lock_free() const noexcept;
+//     void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+//     void store(T desr, memory_order m = memory_order_seq_cst) noexcept;
+//     T load(memory_order m = memory_order_seq_cst) const volatile noexcept;
+//     T load(memory_order m = memory_order_seq_cst) const noexcept;
+//     operator T() const volatile noexcept;
+//     operator T() const noexcept;
+//     T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept;
+//     T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept;
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order s, memory_order f) volatile noexcept;
+//     bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order s, memory_order f) volatile noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order s, memory_order f) noexcept;
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order m = memory_order_seq_cst) volatile noexcept;
+//     bool compare_exchange_weak(T& expc, T desr,
+//                                memory_order m = memory_order_seq_cst) noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                 memory_order m = memory_order_seq_cst) volatile noexcept;
+//     bool compare_exchange_strong(T& expc, T desr,
+//                                  memory_order m = memory_order_seq_cst) noexcept;
+// 
+//     atomic() noexcept = default;
+//     constexpr atomic(T desr) noexcept;
+//     atomic(const atomic&) = delete;
+//     atomic& operator=(const atomic&) = delete;
+//     atomic& operator=(const atomic&) volatile = delete;
+//     T operator=(T) volatile noexcept;
+//     T operator=(T) noexcept;
+// };
+
+#include <atomic>
+#include <new>
+#include <cassert>
+#include <thread> // for thread_id
+#include <chrono> // for nanoseconds
+
+struct TriviallyCopyable {
+    TriviallyCopyable ( int i ) : i_(i) {}
+    int i_;
+    };
+
+template <class T>
+void test ( T t ) {
+    std::atomic<T> t0(t);
+    }
+
+int main()
+{
+    test(TriviallyCopyable(42));
+    test(std::this_thread::get_id());
+    test(std::chrono::nanoseconds(2));
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The 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/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The 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/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The 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/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
+
+// <atomic>
+
+// template <class T>
+//     bool
+//     atomic_compare_exchange_strong(volatile atomic<T>* obj, T* expc, T desr);
+// 
+// template <class T>
+//     bool
+//     atomic_compare_exchange_strong(atomic<T>* obj, T* expc, T desr);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(std::atomic_compare_exchange_strong(&a, &t, T(2)) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_strong(&a, &t, T(3)) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(std::atomic_compare_exchange_strong(&a, &t, T(2)) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_strong(&a, &t, T(3)) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 38
+
+// <atomic>
+
+// template <class T>
+//     bool
+//     atomic_compare_exchange_strong_explicit(volatile atomic<T>* obj, T* expc,
+//                                           T desr,
+//                                           memory_order s, memory_order f);
+// 
+// template <class T>
+//     bool
+//     atomic_compare_exchange_strong_explicit(atomic<T>* obj, T* expc, T desr,
+//                                           memory_order s, memory_order f);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(2),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(3),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(2),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_strong_explicit(&a, &t, T(3),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
+
+// <atomic>
+
+// template <class T>
+//     bool
+//     atomic_compare_exchange_weak(volatile atomic<T>* obj, T* expc, T desr);
+// 
+// template <class T>
+//     bool
+//     atomic_compare_exchange_weak(atomic<T>* obj, T* expc, T desr);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+#include <cmpxchg_loop.h>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2)) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2)) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 38
+
+// <atomic>
+
+// template <class T>
+//     bool
+//     atomic_compare_exchange_weak_explicit(volatile atomic<T>* obj, T* expc,
+//                                           T desr,
+//                                           memory_order s, memory_order f);
+// 
+// template <class T>
+//     bool
+//     atomic_compare_exchange_weak_explicit(atomic<T>* obj, T* expc, T desr,
+//                                           memory_order s, memory_order f);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+#include <cmpxchg_loop.h>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(3),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A a;
+        T t(T(1));
+        std::atomic_init(&a, t);
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
+        assert(a == T(2));
+        assert(t == T(1));
+        assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(3),
+               std::memory_order_seq_cst, std::memory_order_seq_cst) == false);
+        assert(a == T(2));
+        assert(t == T(2));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... fails assertion line 31
+
+// <atomic>
+
+// template <class T>
+//     T
+//     atomic_exchange(volatile atomic<T>* obj, T desr);
+// 
+// template <class T>
+//     T
+//     atomic_exchange(atomic<T>* obj, T desr);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    std::atomic_init(&t, T(1));
+    assert(std::atomic_exchange(&t, T(2)) == T(1));
+    assert(t == T(2));
+    volatile A vt;
+    std::atomic_init(&vt, T(3));
+    assert(std::atomic_exchange(&vt, T(4)) == T(3));
+    assert(vt == T(4));
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 32
+
+// <atomic>
+
+// template <class T>
+//     T
+//     atomic_exchange_explicit(volatile atomic<T>* obj, T desr, memory_order m);
+// 
+// template <class T>
+//     T
+//     atomic_exchange_explicit(atomic<T>* obj, T desr, memory_order m);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    std::atomic_init(&t, T(1));
+    assert(std::atomic_exchange_explicit(&t, T(2), std::memory_order_seq_cst)
+           == T(1));
+    assert(t == T(2));
+    volatile A vt;
+    std::atomic_init(&vt, T(3));
+    assert(std::atomic_exchange_explicit(&vt, T(4), std::memory_order_seq_cst)
+           == T(3));
+    assert(vt == T(4));
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,111 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_add(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_add(atomic<Integral>* obj, Integral op);
+// 
+// template <class T>
+//     T*
+//     atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op);
+// 
+// template <class T>
+//     T*
+//     atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_add(&t, T(2)) == T(1));
+        assert(t == T(3));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_add(&t, T(2)) == T(1));
+        assert(t == T(3));
+    }
+}
+
+template <class T>
+void
+testp()
+{
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        A t;
+        std::atomic_init(&t, T(1*sizeof(X)));
+        assert(std::atomic_fetch_add(&t, 2) == T(1*sizeof(X)));
+        assert(t == T(3*sizeof(X)));
+    }
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        volatile A t;
+        std::atomic_init(&t, T(1*sizeof(X)));
+        assert(std::atomic_fetch_add(&t, 2) == T(1*sizeof(X)));
+        assert(t == T(3*sizeof(X)));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+    A(const A& a) : i(a.i) {}
+    A(const volatile A& a) : i(a.i) {}
+
+    void operator=(const volatile A& a) volatile {i = a.i;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    testp<int*>();
+    testp<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_add_explicit(volatile atomic<Integral>* obj, Integral op,
+//                               memory_order m);
+// template <class Integral>
+//     Integral
+//     atomic_fetch_add_explicit(atomic<Integral>* obj, Integral op,
+//                               memory_order m);
+// template <class T>
+//     T*
+//     atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
+//                               memory_order m);
+// template <class T>
+//     T*
+//     atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_add_explicit(&t, T(2),
+                                            std::memory_order_seq_cst) == T(1));
+        assert(t == T(3));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_add_explicit(&t, T(2),
+                                            std::memory_order_seq_cst) == T(1));
+        assert(t == T(3));
+    }
+}
+
+template <class T>
+void
+testp()
+{
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        A t;
+        std::atomic_init(&t, T(1*sizeof(X)));
+        assert(std::atomic_fetch_add_explicit(&t, 2,
+                                  std::memory_order_seq_cst) == T(1*sizeof(X)));
+        assert(t == T(3*sizeof(X)));
+    }
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        volatile A t;
+        std::atomic_init(&t, T(1*sizeof(X)));
+        assert(std::atomic_fetch_add_explicit(&t, 2,
+                                  std::memory_order_seq_cst) == T(1*sizeof(X)));
+        assert(t == T(3*sizeof(X)));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+    A(const A& a) : i(a.i) {}
+    A(const volatile A& a) : i(a.i) {}
+
+    void operator=(const volatile A& a) volatile {i = a.i;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    testp<int*>();
+    testp<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_and(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_and(atomic<Integral>* obj, Integral op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_and(&t, T(2)) == T(1));
+        assert(t == T(0));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_and(&t, T(2)) == T(3));
+        assert(t == T(2));
+    }
+}
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_and_explicit(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_and_explicit(atomic<Integral>* obj, Integral op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_and_explicit(&t, T(2),
+               std::memory_order_seq_cst) == T(1));
+        assert(t == T(0));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_and_explicit(&t, T(2),
+               std::memory_order_seq_cst) == T(3));
+        assert(t == T(2));
+    }
+}
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_or(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_or(atomic<Integral>* obj, Integral op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_or(&t, T(2)) == T(1));
+        assert(t == T(3));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_or(&t, T(2)) == T(3));
+        assert(t == T(3));
+    }
+}
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_or_explicit(&t, T(2),
+               std::memory_order_seq_cst) == T(1));
+        assert(t == T(3));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_or_explicit(&t, T(2),
+               std::memory_order_seq_cst) == T(3));
+        assert(t == T(3));
+    }
+}
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,111 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_sub(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_sub(atomic<Integral>* obj, Integral op);
+// 
+// template <class T>
+//     T*
+//     atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op);
+// 
+// template <class T>
+//     T*
+//     atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_sub(&t, T(2)) == T(3));
+        assert(t == T(1));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_sub(&t, T(2)) == T(3));
+        assert(t == T(1));
+    }
+}
+
+template <class T>
+void
+testp()
+{
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        A t;
+        std::atomic_init(&t, T(3*sizeof(X)));
+        assert(std::atomic_fetch_sub(&t, 2) == T(3*sizeof(X)));
+        assert(t == T(1*sizeof(X)));
+    }
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        volatile A t;
+        std::atomic_init(&t, T(3*sizeof(X)));
+        assert(std::atomic_fetch_sub(&t, 2) == T(3*sizeof(X)));
+        assert(t == T(1*sizeof(X)));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+    A(const A& a) : i(a.i) {}
+    A(const volatile A& a) : i(a.i) {}
+
+    void operator=(const volatile A& a) volatile {i = a.i;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    testp<int*>();
+    testp<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_sub_explicit(volatile atomic<Integral>* obj, Integral op,
+//                               memory_order m);
+// template <class Integral>
+//     Integral
+//     atomic_fetch_sub_explicit(atomic<Integral>* obj, Integral op,
+//                               memory_order m);
+// 
+// template <class T>
+//     T*
+//     atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
+//                               memory_order m);
+// template <class T>
+//     T*
+//     atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_sub_explicit(&t, T(2),
+                                            std::memory_order_seq_cst) == T(3));
+        assert(t == T(1));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_sub_explicit(&t, T(2),
+                                            std::memory_order_seq_cst) == T(3));
+        assert(t == T(1));
+    }
+}
+
+template <class T>
+void
+testp()
+{
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        A t;
+        std::atomic_init(&t, T(3*sizeof(X)));
+        assert(std::atomic_fetch_sub_explicit(&t, 2,
+                                  std::memory_order_seq_cst) == T(3*sizeof(X)));
+        assert(t == T(1*sizeof(X)));
+    }
+    {
+        typedef std::atomic<T> A;
+        typedef typename std::remove_pointer<T>::type X;
+        volatile A t;
+        std::atomic_init(&t, T(3*sizeof(X)));
+        assert(std::atomic_fetch_sub_explicit(&t, 2,
+                                  std::memory_order_seq_cst) == T(3*sizeof(X)));
+        assert(t == T(1*sizeof(X)));
+    }
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+    A(const A& a) : i(a.i) {}
+    A(const volatile A& a) : i(a.i) {}
+
+    void operator=(const volatile A& a) volatile {i = a.i;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    testp<int*>();
+    testp<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_xor(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_xor(atomic<Integral>* obj, Integral op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_xor(&t, T(2)) == T(1));
+        assert(t == T(3));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_xor(&t, T(2)) == T(3));
+        assert(t == T(1));
+    }
+}
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class Integral>
+//     Integral
+//     atomic_fetch_xor_explicit(volatile atomic<Integral>* obj, Integral op);
+// 
+// template <class Integral>
+//     Integral
+//     atomic_fetch_xor_explicit(atomic<Integral>* obj, Integral op);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+        typedef std::atomic<T> A;
+        A t;
+        std::atomic_init(&t, T(1));
+        assert(std::atomic_fetch_xor_explicit(&t, T(2),
+               std::memory_order_seq_cst) == T(1));
+        assert(t == T(3));
+    }
+    {
+        typedef std::atomic<T> A;
+        volatile A t;
+        std::atomic_init(&t, T(3));
+        assert(std::atomic_fetch_xor_explicit(&t, T(2),
+               std::memory_order_seq_cst) == T(3));
+        assert(t == T(1));
+    }
+}
+
+int main()
+{
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
+
+// <atomic>
+
+// template <class T>
+//     void
+//     atomic_init(volatile atomic<T>* obj, T desr);
+// 
+// template <class T>
+//     void
+//     atomic_init(atomic<T>* obj, T desr);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    std::atomic_init(&t, T(1));
+    assert(t == T(1));
+    volatile A vt;
+    std::atomic_init(&vt, T(2));
+    assert(vt == T(2));
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// template <class T>
+//     bool
+//     atomic_is_lock_free(const volatile atomic<T>* obj);
+// 
+// template <class T>
+//     bool
+//     atomic_is_lock_free(const atomic<T>* obj);
+
+#include <atomic>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    bool b1 = std::atomic_is_lock_free(static_cast<const A*>(&t));
+    volatile A vt;
+    bool b2 = std::atomic_is_lock_free(static_cast<const volatile A*>(&vt));
+}
+
+struct A
+{
+    char _[4];
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
+
+// <atomic>
+
+// template <class T>
+//     T
+//     atomic_load(const volatile atomic<T>* obj);
+// 
+// template <class T>
+//     T
+//     atomic_load(const atomic<T>* obj);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    std::atomic_init(&t, T(1));
+    assert(std::atomic_load(&t) == T(1));
+    volatile A vt;
+    std::atomic_init(&vt, T(2));
+    assert(std::atomic_load(&vt) == T(2));
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 31
+
+// <atomic>
+
+// template <class T>
+//     T
+//     atomic_load_explicit(const volatile atomic<T>* obj, memory_order m);
+// 
+// template <class T>
+//     T
+//     atomic_load_explicit(const atomic<T>* obj, memory_order m);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    std::atomic_init(&t, T(1));
+    assert(std::atomic_load_explicit(&t, std::memory_order_seq_cst) == T(1));
+    volatile A vt;
+    std::atomic_init(&vt, T(2));
+    assert(std::atomic_load_explicit(&vt, std::memory_order_seq_cst) == T(2));
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 31
+
+// <atomic>
+
+// template <class T>
+//     void
+//     atomic_store(volatile atomic<T>* obj, T desr);
+// 
+// template <class T>
+//     void
+//     atomic_store(atomic<T>* obj, T desr);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    std::atomic_store(&t, T(1));
+    assert(t == T(1));
+    volatile A vt;
+    std::atomic_store(&vt, T(2));
+    assert(vt == T(2));
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 31
+
+// <atomic>
+
+// template <class T>
+//     void
+//     atomic_store_explicit(volatile atomic<T>* obj, T desr, memory_order m);
+// 
+// template <class T>
+//     void
+//     atomic_store_explicit(atomic<T>* obj, T desr, memory_order m);
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    typedef std::atomic<T> A;
+    A t;
+    std::atomic_store_explicit(&t, T(1), std::memory_order_seq_cst);
+    assert(t == T(1));
+    volatile A vt;
+    std::atomic_store_explicit(&vt, T(2), std::memory_order_seq_cst);
+    assert(vt == T(2));
+}
+
+struct A
+{
+    int i;
+
+    explicit A(int d = 0) noexcept {i=d;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.i == y.i;}
+};
+
+int main()
+{
+    test<A>();
+    test<char>();
+    test<signed char>();
+    test<unsigned char>();
+    test<short>();
+    test<unsigned short>();
+    test<int>();
+    test<unsigned int>();
+    test<long>();
+    test<unsigned long>();
+    test<long long>();
+    test<unsigned long long>();
+    test<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<char16_t>();
+    test<char32_t>();
+#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+    test<int*>();
+    test<const int*>();
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// #define ATOMIC_VAR_INIT(value)
+
+#include <atomic>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    std::atomic<int> v = ATOMIC_VAR_INIT(5);
+    assert(v == 5);
+}

Added: libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The 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/atomics/atomics.types.operations/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.operations/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/atomics.types.operations/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/atomics.types.operations/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The 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/atomics/libcpp-has-no-threads.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/libcpp-has-no-threads.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/libcpp-has-no-threads.fail.cpp (added)
+++ libcxx/trunk/test/std/atomics/libcpp-has-no-threads.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// Test that including <atomic> fails to compile when _LIBCPP_HAS_NO_THREADS
+// is defined.
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+#define _LIBCPP_HAS_NO_THREADS
+#endif
+
+#include <atomic>
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/atomics/libcpp-has-no-threads.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/libcpp-has-no-threads.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/atomics/libcpp-has-no-threads.pass.cpp (added)
+++ libcxx/trunk/test/std/atomics/libcpp-has-no-threads.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.
+//
+//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-has-no-threads
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error This should be XFAIL'd for the purpose of detecting that the LIT feature\
+ 'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
+#endif
+
+int main()
+{
+}

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

Added: libcxx/trunk/test/std/containers/Copyable.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/Copyable.h?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/Copyable.h (added)
+++ libcxx/trunk/test/std/containers/Copyable.h 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.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef COPYABLE_H
+#define COPYABLE_H
+
+class Copyable
+{
+public:
+};
+
+#endif  // COPYABLE_H

Added: libcxx/trunk/test/std/containers/Emplaceable.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/Emplaceable.h?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/Emplaceable.h (added)
+++ libcxx/trunk/test/std/containers/Emplaceable.h 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.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef EMPLACEABLE_H
+#define EMPLACEABLE_H
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+class Emplaceable
+{
+    Emplaceable(const Emplaceable&);
+    Emplaceable& operator=(const Emplaceable&);
+
+    int int_;
+    double double_;
+public:
+    Emplaceable() : int_(0), double_(0) {}
+    Emplaceable(int i, double d) : int_(i), double_(d) {}
+    Emplaceable(Emplaceable&& x)
+        : int_(x.int_), double_(x.double_)
+            {x.int_ = 0; x.double_ = 0;}
+    Emplaceable& operator=(Emplaceable&& x)
+        {int_ = x.int_; x.int_ = 0;
+         double_ = x.double_; x.double_ = 0;
+         return *this;}
+
+    bool operator==(const Emplaceable& x) const
+        {return int_ == x.int_ && double_ == x.double_;}
+    bool operator<(const Emplaceable& x) const
+        {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
+
+    int get() const {return int_;}
+};
+
+namespace std {
+
+template <>
+struct hash<Emplaceable>
+    : public std::unary_function<Emplaceable, std::size_t>
+{
+    std::size_t operator()(const Emplaceable& x) const {return x.get();}
+};
+
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#endif  // EMPLACEABLE_H

Added: libcxx/trunk/test/std/containers/MoveOnly.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/MoveOnly.h?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/MoveOnly.h (added)
+++ libcxx/trunk/test/std/containers/MoveOnly.h 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.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MOVEONLY_H
+#define MOVEONLY_H
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#include <cstddef>
+#include <functional>
+
+class MoveOnly
+{
+    MoveOnly(const MoveOnly&);
+    MoveOnly& operator=(const MoveOnly&);
+
+    int data_;
+public:
+    MoveOnly(int data = 1) : data_(data) {}
+    MoveOnly(MoveOnly&& x)
+        : data_(x.data_) {x.data_ = 0;}
+    MoveOnly& operator=(MoveOnly&& x)
+        {data_ = x.data_; x.data_ = 0; return *this;}
+
+    int get() const {return data_;}
+
+    bool operator==(const MoveOnly& x) const {return data_ == x.data_;}
+    bool operator< (const MoveOnly& x) const {return data_ <  x.data_;}
+};
+
+namespace std {
+
+template <>
+struct hash<MoveOnly>
+    : public std::unary_function<MoveOnly, std::size_t>
+{
+    std::size_t operator()(const MoveOnly& x) const {return x.get();}
+};
+
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#endif  // MOVEONLY_H

Added: libcxx/trunk/test/std/containers/NotConstructible.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/NotConstructible.h?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/NotConstructible.h (added)
+++ libcxx/trunk/test/std/containers/NotConstructible.h 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.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef NOTCONSTRUCTIBLE_H
+#define NOTCONSTRUCTIBLE_H
+
+#include <functional>
+
+class NotConstructible
+{
+    NotConstructible(const NotConstructible&);
+    NotConstructible& operator=(const NotConstructible&);
+public:
+};
+
+inline
+bool
+operator==(const NotConstructible&, const NotConstructible&)
+{return true;}
+
+namespace std
+{
+
+template <>
+struct hash<NotConstructible>
+    : public std::unary_function<NotConstructible, std::size_t>
+{
+    std::size_t operator()(const NotConstructible&) const {return 0;}
+};
+
+}
+
+#endif  // NOTCONSTRUCTIBLE_H

Added: libcxx/trunk/test/std/containers/associative/map/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/compare.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// template <class Key, class T, class Compare = less<Key>,
+//           class Allocator = allocator<pair<const Key, T>>>
+// class map
+
+// http://llvm.org/bugs/show_bug.cgi?id=16538
+// http://llvm.org/bugs/show_bug.cgi?id=16549
+
+#include <map>
+
+struct Key {
+  template <typename T> Key(const T&) {}
+  bool operator< (const Key&) const { return false; }
+};
+
+int
+main()
+{
+    std::map<Key, int>::iterator it = std::map<Key, int>().find(Key(0));
+    std::pair<std::map<Key, int>::iterator, bool> result =
+                        std::map<Key, int>().insert(std::make_pair(Key(0), 0));
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.access/at.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/at.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/at.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/at.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+//       mapped_type& at(const key_type& k);
+// const mapped_type& at(const key_type& k) const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1.5),
+            V(2, 2.5),
+            V(3, 3.5),
+            V(4, 4.5),
+            V(5, 5.5),
+            V(7, 7.5),
+            V(8, 8.5),
+        };
+        std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 7);
+        assert(m.at(1) == 1.5);
+        m.at(1) = -1.5;
+        assert(m.at(1) == -1.5);
+        assert(m.at(2) == 2.5);
+        assert(m.at(3) == 3.5);
+        assert(m.at(4) == 4.5);
+        assert(m.at(5) == 5.5);
+        try
+        {
+            m.at(6);
+            assert(false);
+        }
+        catch (std::out_of_range&)
+        {
+        }
+        assert(m.at(7) == 7.5);
+        assert(m.at(8) == 8.5);
+        assert(m.size() == 7);
+    }
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1.5),
+            V(2, 2.5),
+            V(3, 3.5),
+            V(4, 4.5),
+            V(5, 5.5),
+            V(7, 7.5),
+            V(8, 8.5),
+        };
+        const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 7);
+        assert(m.at(1) == 1.5);
+        assert(m.at(2) == 2.5);
+        assert(m.at(3) == 3.5);
+        assert(m.at(4) == 4.5);
+        assert(m.at(5) == 5.5);
+        try
+        {
+            m.at(6);
+            assert(false);
+        }
+        catch (std::out_of_range&)
+        {
+        }
+        assert(m.at(7) == 7.5);
+        assert(m.at(8) == 8.5);
+        assert(m.size() == 7);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1.5),
+            V(2, 2.5),
+            V(3, 3.5),
+            V(4, 4.5),
+            V(5, 5.5),
+            V(7, 7.5),
+            V(8, 8.5),
+        };
+        std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 7);
+        assert(m.at(1) == 1.5);
+        m.at(1) = -1.5;
+        assert(m.at(1) == -1.5);
+        assert(m.at(2) == 2.5);
+        assert(m.at(3) == 3.5);
+        assert(m.at(4) == 4.5);
+        assert(m.at(5) == 5.5);
+        try
+        {
+            m.at(6);
+            assert(false);
+        }
+        catch (std::out_of_range&)
+        {
+        }
+        assert(m.at(7) == 7.5);
+        assert(m.at(8) == 8.5);
+        assert(m.size() == 7);
+    }
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1.5),
+            V(2, 2.5),
+            V(3, 3.5),
+            V(4, 4.5),
+            V(5, 5.5),
+            V(7, 7.5),
+            V(8, 8.5),
+        };
+        const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 7);
+        assert(m.at(1) == 1.5);
+        assert(m.at(2) == 2.5);
+        assert(m.at(3) == 3.5);
+        assert(m.at(4) == 4.5);
+        assert(m.at(5) == 5.5);
+        try
+        {
+            m.at(6);
+            assert(false);
+        }
+        catch (std::out_of_range&)
+        {
+        }
+        assert(m.at(7) == 7.5);
+        assert(m.at(8) == 8.5);
+        assert(m.size() == 7);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.access/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// bool empty() const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::map<int, double> M;
+    M m;
+    assert(m.empty());
+    m.insert(M::value_type(1, 1.5));
+    assert(!m.empty());
+    m.clear();
+    assert(m.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+    M m;
+    assert(m.empty());
+    m.insert(M::value_type(1, 1.5));
+    assert(!m.empty());
+    m.clear();
+    assert(m.empty());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.access/index_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/index_key.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/index_key.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/index_key.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// mapped_type& operator[](const key_type& k);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1.5),
+        V(2, 2.5),
+        V(3, 3.5),
+        V(4, 4.5),
+        V(5, 5.5),
+        V(7, 7.5),
+        V(8, 8.5),
+    };
+    std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    assert(m.size() == 7);
+    assert(m[1] == 1.5);
+    assert(m.size() == 7);
+    m[1] = -1.5;
+    assert(m[1] == -1.5);
+    assert(m.size() == 7);
+    assert(m[6] == 0);
+    assert(m.size() == 8);
+    m[6] = 6.5;
+    assert(m[6] == 6.5);
+    assert(m.size() == 8);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1.5),
+        V(2, 2.5),
+        V(3, 3.5),
+        V(4, 4.5),
+        V(5, 5.5),
+        V(7, 7.5),
+        V(8, 8.5),
+    };
+    std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    assert(m.size() == 7);
+    assert(m[1] == 1.5);
+    assert(m.size() == 7);
+    const int i = 1;
+    m[i] = -1.5;
+    assert(m[1] == -1.5);
+    assert(m.size() == 7);
+    assert(m[6] == 0);
+    assert(m.size() == 8);
+    m[6] = 6.5;
+    assert(m[6] == 6.5);
+    assert(m.size() == 8);
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1.5),
+        V(2, 2.5),
+        V(3, 3.5),
+        V(4, 4.5),
+        V(5, 5.5),
+        V(7, 7.5),
+        V(8, 8.5),
+    };
+    std::map<int, double, std::less<>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+
+    assert(m.size() == 7);
+    assert(m[1] == 1.5);
+    assert(m.size() == 7);
+    m[1] = -1.5;
+    assert(m[1] == -1.5);
+    assert(m.size() == 7);
+    assert(m[6] == 0);
+    assert(m.size() == 8);
+    m[6] = 6.5;
+    assert(m[6] == 6.5);
+    assert(m.size() == 8);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/index_rv_key.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// mapped_type& operator[](key_type&& k);
+
+#include <map>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    typedef std::pair<MoveOnly, double> V;
+    std::map<MoveOnly, double> m;
+    assert(m.size() == 0);
+    assert(m[1] == 0.0);
+    assert(m.size() == 1);
+    m[1] = -1.5;
+    assert(m[1] == -1.5);
+    assert(m.size() == 1);
+    assert(m[6] == 0);
+    assert(m.size() == 2);
+    m[6] = 6.5;
+    assert(m[6] == 6.5);
+    assert(m.size() == 2);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<MoveOnly, double> V;
+    std::map<MoveOnly, double, std::less<MoveOnly>, min_allocator<V>> m;
+    assert(m.size() == 0);
+    assert(m[1] == 0.0);
+    assert(m.size() == 1);
+    m[1] = -1.5;
+    assert(m[1] == -1.5);
+    assert(m.size() == 1);
+    assert(m[6] == 0);
+    assert(m.size() == 2);
+    m[6] = 6.5;
+    assert(m[6] == 6.5);
+    assert(m.size() == 2);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.access/index_tuple.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/index_tuple.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/index_tuple.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/index_tuple.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// mapped_type& operator[](const key_type& k);
+
+// http://llvm.org/bugs/show_bug.cgi?id=16542
+
+#include <map>
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+#include <tuple>
+
+#endif
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    using namespace std;
+    map<tuple<int,int>, size_t> m;
+    m[make_tuple(2,3)]=7;
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,227 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+//       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 <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        std::map<int, double> 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::map<int, double>::iterator i;
+        i = m.begin();
+        std::map<int, double>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= m.size(); ++j, ++i)
+        {
+            assert(i->first == j);
+            assert(i->second == 1);
+            i->second = 2.5;
+            assert(i->second == 2.5);
+        }
+    }
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        const std::map<int, double> 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::map<int, double>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= m.size(); ++j, ++i)
+        {
+            assert(i->first == j);
+            assert(i->second == 1);
+        }
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        std::map<int, double, std::less<int>, min_allocator<V>> 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::map<int, double, std::less<int>, min_allocator<V>>::iterator i;
+        i = m.begin();
+        std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= m.size(); ++j, ++i)
+        {
+            assert(i->first == j);
+            assert(i->second == 1);
+            i->second = 2.5;
+            assert(i->second == 2.5);
+        }
+    }
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        const std::map<int, double, std::less<int>, min_allocator<V>> 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::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= m.size(); ++j, ++i)
+        {
+            assert(i->first == j);
+            assert(i->second == 1);
+        }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    { // N3644 testing
+        typedef std::map<int, double> 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/map/map.access/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/max_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/max_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// size_type max_size() const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::map<int, double> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.access/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.access/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.access/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.access/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// size_type size() const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::map<int, double> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2, 1.5));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1, 1.5));
+    assert(m.size() == 2);
+    m.insert(M::value_type(3, 1.5));
+    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::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2, 1.5));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1, 1.5));
+    assert(m.size() == 2);
+    m.insert(M::value_type(3, 1.5));
+    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/map/map.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// explicit map(const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::less<int> C;
+    typedef test_allocator<std::pair<const int, double> > A;
+    std::map<int, double, C, A> m(A(5));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.get_allocator() == A(5));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::less<int> C;
+    typedef min_allocator<std::pair<const int, double> > A;
+    std::map<int, double, C, A> m(A{});
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map& operator=(initializer_list<value_type> il);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::pair<const int, double> V;
+    std::map<int, double> m =
+                            {
+                                {20, 1},
+                            };
+    m =
+                            {
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {2, 1},
+                                {2, 1.5},
+                                {2, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                            };
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    std::map<int, double, std::less<int>, min_allocator<V>> m =
+                            {
+                                {20, 1},
+                            };
+    m =
+                            {
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {2, 1},
+                                {2, 1.5},
+                                {2, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                            };
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/compare.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// explicit map(const key_compare& comp);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef test_compare<std::less<int> > C;
+    std::map<int, double, C> m(C(3));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(3));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef test_compare<std::less<int> > C;
+    std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(3));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/compare_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/compare_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map(const key_compare& comp, const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<std::pair<const int, double> > A;
+    std::map<int, double, 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));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef test_compare<std::less<int> > C;
+    typedef min_allocator<std::pair<const int, double> > A;
+    std::map<int, double, C, A> m(C(4), A());
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(4));
+    assert(m.get_allocator() == A());
+    }
+#endif
+}

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

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/copy_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map(const map& m, const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<V> A;
+    std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+    std::map<int, double, 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() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+
+    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() == V(1, 1));
+    assert(*next(mo.begin()) == V(2, 1));
+    assert(*next(mo.begin(), 2) == V(3, 1));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef min_allocator<V> A;
+    std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+    std::map<int, double, C, A> m(mo, A());
+    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() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+
+    assert(mo.get_allocator() == A());
+    assert(mo.key_comp() == C(5));
+    assert(mo.size() == 3);
+    assert(distance(mo.begin(), mo.end()) == 3);
+    assert(*mo.begin() == V(1, 1));
+    assert(*next(mo.begin()) == V(2, 1));
+    assert(*next(mo.begin(), 2) == V(3, 1));
+    }
+#endif
+}

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

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map();
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    std::map<int, double> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+    std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+    {
+    std::map<int, double> m = {};
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// map()
+//    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 <map>
+#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::map<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map();
+
+#include <map>
+
+#if !__has_feature(cxx_noexcept)
+
+struct X
+{
+    std::map<int, X> m;
+};
+
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// ~map() // implied noexcept;
+
+#include <map>
+#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::map<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map(initializer_list<value_type> il);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::pair<const int, double> V;
+    std::map<int, double> m =
+                            {
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {2, 1},
+                                {2, 1.5},
+                                {2, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                            };
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    std::map<int, double, std::less<int>, min_allocator<V>> m =
+                            {
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {2, 1},
+                                {2, 1.5},
+                                {2, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                            };
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list_compare.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map(initializer_list<value_type> il, const key_compare& comp);
+
+#include <map>
+#include <cassert>
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::pair<const int, double> V;
+    typedef test_compare<std::less<int> > C;
+    std::map<int, double, C> m({
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {2, 1},
+                                {2, 1.5},
+                                {2, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                               }, C(3));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    assert(m.key_comp() == C(3));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    typedef test_compare<std::less<int> > C;
+    std::map<int, double, C, min_allocator<std::pair<const int, double>>> m({
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {2, 1},
+                                {2, 1.5},
+                                {2, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                               }, C(3));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    assert(m.key_comp() == C(3));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

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

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// template <class InputIterator>
+//     map(InputIterator first, InputIterator last);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// template <class InputIterator>
+//     map(InputIterator first, InputIterator last, const key_compare& comp);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    std::map<int, double, C> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// template <class InputIterator>
+//     map(InputIterator first, InputIterator last,
+//         const key_compare& comp, const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<V> A;
+    std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+    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() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef min_allocator<V> A;
+    std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+    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() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef std::pair<const int, double> V;
+    typedef min_allocator<V> A;
+    typedef test_compare<std::less<int> > C;
+    A a;
+    std::map<int, double, 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() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    assert(m.get_allocator() == a);
+    }
+#endif
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map(map&& m);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    typedef std::pair<const int, double> V;
+    {
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::map<int, double, C, A> mo(C(5), A(7));
+        std::map<int, double, 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);
+    }
+    {
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::map<int, double, 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() == V(1, 1));
+        assert(*next(m.begin()) == V(2, 1));
+        assert(*next(m.begin(), 2) == V(3, 1));
+
+        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 test_compare<std::less<int> > C;
+        typedef min_allocator<V> A;
+        std::map<int, double, C, A> mo(C(5), A());
+        std::map<int, double, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A());
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 0);
+        assert(distance(m.begin(), m.end()) == 0);
+
+        assert(mo.get_allocator() == A());
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 0);
+        assert(distance(mo.begin(), mo.end()) == 0);
+    }
+    {
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef min_allocator<V> A;
+        std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+        std::map<int, double, 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() == V(1, 1));
+        assert(*next(m.begin()) == V(2, 1));
+        assert(*next(m.begin(), 2) == V(3, 1));
+
+        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/map/map.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/move_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map(map&& m, const allocator_type& a);
+
+#include <map>
+#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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef other_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef min_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+        M m3(std::move(m1), A());
+        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/map/map.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// map& operator=(map&& m);
+
+#include <map>
+#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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef other_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef min_allocator<VC> A;
+        typedef std::map<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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/map/map.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// map& operator=(map&& 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 <map>
+#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::map<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// map(map&&)
+//        noexcept(is_nothrow_move_constructible<allocator_type>::value &&
+//                 is_nothrow_move_constructible<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <map>
+#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::map<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.modifiers/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.modifiers/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// void clear();
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::map<int, double> M;
+        typedef std::pair<int, double> P;
+        P ar[] =
+        {
+            P(1, 1.5),
+            P(2, 2.5),
+            P(3, 3.5),
+            P(4, 4.5),
+            P(5, 5.5),
+            P(6, 6.5),
+            P(7, 7.5),
+            P(8, 8.5),
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        m.clear();
+        assert(m.size() == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef std::pair<int, double> P;
+        P ar[] =
+        {
+            P(1, 1.5),
+            P(2, 2.5),
+            P(3, 3.5),
+            P(4, 4.5),
+            P(5, 5.5),
+            P(6, 6.5),
+            P(7, 7.5),
+            P(8, 8.5),
+        };
+        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/map/map.modifiers/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,165 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// template <class... Args>
+//   pair<iterator, bool> emplace(Args&&... args);
+
+#include <map>
+#include <cassert>
+#include <tuple>
+
+#include "../../../Emplaceable.h"
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::map<int, 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()->first == 0);
+        assert(m.begin()->second == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(r.second);
+        assert(r.first == next(m.begin()));
+        assert(m.size() == 2);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(!r.second);
+        assert(r.first == next(m.begin()));
+        assert(m.size() == 2);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::map<int, Emplaceable> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
+                                                  std::forward_as_tuple());
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == Emplaceable());
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(2, 3.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == Emplaceable(2, 3.5));
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(2, 3.5));
+        assert(!r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == Emplaceable(2, 3.5));
+    }
+    {
+        typedef std::map<int, double> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.emplace(M::value_type(2, 3.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == 3.5);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, 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()->first == 0);
+        assert(m.begin()->second == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(r.second);
+        assert(r.first == next(m.begin()));
+        assert(m.size() == 2);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(!r.second);
+        assert(r.first == next(m.begin()));
+        assert(m.size() == 2);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
+                                                  std::forward_as_tuple());
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == Emplaceable());
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(2, 3.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == Emplaceable(2, 3.5));
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(2, 3.5));
+        assert(!r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == Emplaceable(2, 3.5));
+    }
+    {
+        typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.emplace(M::value_type(2, 3.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == 3.5);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

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

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

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

Added: libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_cv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// pair<iterator, bool> insert(const value_type& v);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::map<int, double> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.insert(M::value_type(2, 2.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(r.first->first == 2);
+        assert(r.first->second == 2.5);
+
+        r = m.insert(M::value_type(1, 1.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(r.first->first == 1);
+        assert(r.first->second == 1.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r.first->first == 3);
+        assert(r.first->second == 3.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(!r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r.first->first == 3);
+        assert(r.first->second == 3.5);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef std::pair<M::iterator, bool> R;
+        M m;
+        R r = m.insert(M::value_type(2, 2.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 1);
+        assert(r.first->first == 2);
+        assert(r.first->second == 2.5);
+
+        r = m.insert(M::value_type(1, 1.5));
+        assert(r.second);
+        assert(r.first == m.begin());
+        assert(m.size() == 2);
+        assert(r.first->first == 1);
+        assert(r.first->second == 1.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r.first->first == 3);
+        assert(r.first->second == 3.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(!r.second);
+        assert(r.first == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r.first->first == 3);
+        assert(r.first->second == 3.5);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_initializer_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// void insert(initializer_list<value_type> il);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::pair<const int, double> V;
+    std::map<int, double> m =
+                            {
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                            };
+    m.insert({
+                 {2, 1},
+                 {2, 1.5},
+                 {2, 2},
+             });
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    std::map<int, double, std::less<int>, min_allocator<V>> m =
+                            {
+                                {1, 1},
+                                {1, 1.5},
+                                {1, 2},
+                                {3, 1},
+                                {3, 1.5},
+                                {3, 2}
+                            };
+    m.insert({
+                 {2, 1},
+                 {2, 1.5},
+                 {2, 2},
+             });
+    assert(m.size() == 3);
+    assert(distance(m.begin(), m.end()) == 3);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(2, 1));
+    assert(*next(m.begin(), 2) == V(3, 1));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// iterator insert(const_iterator position, const value_type& v);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::map<int, double> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.end(), M::value_type(2, 2.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2.5);
+
+        r = m.insert(m.end(), M::value_type(1, 1.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1.5);
+
+        r = m.insert(m.end(), M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+
+        r = m.insert(m.end(), M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.end(), M::value_type(2, 2.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2.5);
+
+        r = m.insert(m.end(), M::value_type(1, 1.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1.5);
+
+        r = m.insert(m.end(), M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+
+        r = m.insert(m.end(), M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_iter.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// template <class InputIterator>
+//   void insert(InputIterator first, InputIterator last);
+
+#include <map>
+#include <cassert>
+
+#include "test_iterators.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::map<int, double> M;
+        typedef std::pair<int, double> P;
+        P ar[] =
+        {
+            P(1, 1),
+            P(1, 1.5),
+            P(1, 2),
+            P(2, 1),
+            P(2, 1.5),
+            P(2, 2),
+            P(3, 1),
+            P(3, 1.5),
+            P(3, 2),
+        };
+        M m;
+        m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
+        assert(m.size() == 3);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == 1);
+        assert(next(m.begin())->first == 2);
+        assert(next(m.begin())->second == 1);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 1);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef std::pair<int, double> P;
+        P ar[] =
+        {
+            P(1, 1),
+            P(1, 1.5),
+            P(1, 2),
+            P(2, 1),
+            P(2, 1.5),
+            P(2, 2),
+            P(3, 1),
+            P(3, 1.5),
+            P(3, 2),
+        };
+        M m;
+        m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
+        assert(m.size() == 3);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == 1);
+        assert(next(m.begin())->first == 2);
+        assert(next(m.begin())->second == 1);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 1);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_iter_rv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// template <class P>
+//     iterator insert(const_iterator position, P&& p);
+
+#include <map>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::map<int, MoveOnly> M;
+        typedef std::pair<int, MoveOnly> P;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.end(), P(2, 2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2);
+
+        r = m.insert(m.end(), P(1, 1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1);
+
+        r = m.insert(m.end(), P(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+
+        r = m.insert(m.end(), P(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+        typedef std::pair<int, MoveOnly> P;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.end(), P(2, 2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2);
+
+        r = m.insert(m.end(), P(1, 1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1);
+
+        r = m.insert(m.end(), P(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+
+        r = m.insert(m.end(), P(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

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

Added: libcxx/trunk/test/std/containers/associative/map/map.ops/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.ops/count.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.ops/count.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.ops/count.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,173 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// size_type count(const key_type& k) const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double> M;
+    {
+        typedef M::size_type R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+    {
+        typedef M::size_type R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less <>> M;
+    typedef M::size_type R;
+
+    V ar[] =
+    {
+        V(5, 5),
+        V(6, 6),
+        V(7, 7),
+        V(8, 8),
+        V(9, 9),
+        V(10, 10),
+        V(11, 11),
+        V(12, 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 PC;
+    typedef std::map<PC, double, std::less<>> M;
+    typedef M::size_type R;
+
+    M m;
+    m [ PC::make(5)  ] = 5;
+    m [ PC::make(6)  ] = 6;
+    m [ PC::make(7)  ] = 7;
+    m [ PC::make(8)  ] = 8;
+    m [ PC::make(9)  ] = 9;
+    m [ PC::make(10) ] = 10;
+    m [ PC::make(11) ] = 11;
+    m [ PC::make(12) ] = 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/map/map.ops/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,437 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// pair<iterator,iterator>             equal_range(const key_type& k);
+// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double> M;
+    {
+        typedef std::pair<M::iterator, M::iterator> R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+    {
+        typedef std::pair<M::iterator, M::iterator> R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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));
+    }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<>> M;
+    typedef std::pair<M::iterator, M::iterator> R;
+
+    V ar[] =
+    {
+        V(5, 5),
+        V(7, 6),
+        V(9, 7),
+        V(11, 8),
+        V(13, 9),
+        V(15, 10),
+        V(17, 11),
+        V(19, 12)
+    };
+    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 PC;
+    typedef std::map<PC, double, std::less<>> M;
+    typedef std::pair<M::iterator, M::iterator> R;
+
+    M m;
+    m [ PC::make(5)  ] = 5;
+    m [ PC::make(7)  ] = 6;
+    m [ PC::make(9)  ] = 7;
+    m [ PC::make(11) ] = 8;
+    m [ PC::make(13) ] = 9;
+    m [ PC::make(15) ] = 10;
+    m [ PC::make(17) ] = 11;
+    m [ PC::make(19) ] = 12;
+
+    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/map/map.ops/find.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.ops/find.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.ops/find.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.ops/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+//       iterator find(const key_type& k);
+// const_iterator find(const key_type& k) const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<>> M;
+    typedef M::iterator R;
+
+    V ar[] =
+    {
+        V(5, 5),
+        V(6, 6),
+        V(7, 7),
+        V(8, 8),
+        V(9, 9),
+        V(10, 10),
+        V(11, 11),
+        V(12, 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 PC;
+    typedef std::map<PC, double, std::less<>> M;
+    typedef M::iterator R;
+
+    M m;
+    m [ PC::make(5)  ] = 5;
+    m [ PC::make(6)  ] = 6;
+    m [ PC::make(7)  ] = 7;
+    m [ PC::make(8)  ] = 8;
+    m [ PC::make(9)  ] = 9;
+    m [ PC::make(10) ] = 10;
+    m [ PC::make(11) ] = 11;
+    m [ PC::make(12) ] = 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/map/map.ops/lower_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.ops/lower_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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+//       iterator lower_bound(const key_type& k);
+// const_iterator lower_bound(const key_type& k) const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less <>> M;
+    typedef M::iterator R;
+
+    V ar[] =
+    {
+        V(5, 5),
+        V(7, 6),
+        V(9, 7),
+        V(11, 8),
+        V(13, 9),
+        V(15, 10),
+        V(17, 11),
+        V(19, 12)
+    };
+    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 PC;
+    typedef std::map<PC, double, std::less<>> M;
+    typedef M::iterator R;
+
+    M m;
+    m [ PC::make(5)  ] = 5;
+    m [ PC::make(7)  ] = 6;
+    m [ PC::make(9)  ] = 7;
+    m [ PC::make(11) ] = 8;
+    m [ PC::make(13) ] = 9;
+    m [ PC::make(15) ] = 10;
+    m [ PC::make(17) ] = 11;
+    m [ PC::make(19) ] = 12;
+
+    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/map/map.ops/upper_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,335 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+//       iterator upper_bound(const key_type& k);
+// const_iterator upper_bound(const key_type& k) const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+    {
+        typedef M::iterator R;
+        V ar[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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[] =
+        {
+            V(5, 5),
+            V(7, 6),
+            V(9, 7),
+            V(11, 8),
+            V(13, 9),
+            V(15, 10),
+            V(17, 11),
+            V(19, 12)
+        };
+        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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<>> M;
+    typedef M::iterator R;
+    V ar[] =
+    {
+        V(5, 5),
+        V(7, 6),
+        V(9, 7),
+        V(11, 8),
+        V(13, 9),
+        V(15, 10),
+        V(17, 11),
+        V(19, 12)
+    };
+    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 PC;
+    typedef std::map<PC, double, std::less<>> M;
+    typedef M::iterator R;
+
+    M m;
+    m [ PC::make(5)  ] = 5;
+    m [ PC::make(7)  ] = 6;
+    m [ PC::make(9)  ] = 7;
+    m [ PC::make(11) ] = 8;
+    m [ PC::make(13) ] = 9;
+    m [ PC::make(15) ] = 10;
+    m [ PC::make(17) ] = 11;
+    m [ PC::make(19) ] = 12;
+
+    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/map/map.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.special/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.special/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// void swap(map& m);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<int>, min_allocator<V>> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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/map/map.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,306 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// template <class Key, class T, class Compare, class Allocator>
+//   void
+//   swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y);
+
+#include <map>
+#include <cassert>
+#include "test_allocator.h"
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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::map<int, double, C, A> M;
+        V ar1[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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::map<int, double, C, A> M;
+        V ar1[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double, std::less<int>, min_allocator<V>> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 min_allocator<V> A;
+        typedef test_compare<std::less<int> > C;
+        typedef std::map<int, double, C, A> M;
+        V ar1[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 12)
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
+        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());
+        assert(m2.key_comp() == C(1));
+        assert(m2.get_allocator() == A());
+    }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/map.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// void swap(map& c)
+//     noexcept(!allocator_type::propagate_on_container_swap::value ||
+//              __is_nothrow_swappable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <map>
+#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::map<MoveOnly, MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        C c1, c2;
+        static_assert(!noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/map/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// template <class Key, class T, class Compare = less<Key>,
+//           class Allocator = allocator<pair<const Key, T>>>
+// class map
+// {
+// public:
+//     // types:
+//     typedef Key                                      key_type;
+//     typedef T                                        mapped_type;
+//     typedef pair<const key_type, mapped_type>        value_type;
+//     typedef Compare                                  key_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 <map>
+#include <type_traits>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::map<int, double> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::mapped_type, double>::value), "");
+    static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, std::allocator<std::pair<const int, double> > >::value), "");
+    static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::pointer, std::pair<const int, double>*>::value), "");
+    static_assert((std::is_same<C::const_pointer, const std::pair<const int, double>*>::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::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::mapped_type, double>::value), "");
+    static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
+    static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::pointer, min_pointer<std::pair<const int, double>>>::value), "");
+    static_assert((std::is_same<C::const_pointer, min_pointer<const std::pair<const int, double>>>::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/map/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/version.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/map/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+#include <map>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// bool empty() const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multimap<int, double> M;
+    M m;
+    assert(m.empty());
+    m.insert(M::value_type(1, 1.5));
+    assert(!m.empty());
+    m.clear();
+    assert(m.empty());
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+    M m;
+    assert(m.empty());
+    m.insert(M::value_type(1, 1.5));
+    assert(!m.empty());
+    m.clear();
+    assert(m.empty());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,231 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+//       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 <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        std::multimap<int, double> 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::multimap<int, double>::iterator i;
+        i = m.begin();
+        std::multimap<int, double>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= 8; ++j)
+            for (double d = 1; d <= 2; d += .5, ++i)
+            {
+                assert(i->first == j);
+                assert(i->second == d);
+                i->second = 2.5;
+                assert(i->second == 2.5);
+            }
+    }
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        const std::multimap<int, double> 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::multimap<int, double>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= 8; ++j)
+            for (double d = 1; d <= 2; d += .5, ++i)
+            {
+                assert(i->first == j);
+                assert(i->second == d);
+            }
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        std::multimap<int, double, std::less<int>, min_allocator<V>> 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::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i;
+        i = m.begin();
+        std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= 8; ++j)
+            for (double d = 1; d <= 2; d += .5, ++i)
+            {
+                assert(i->first == j);
+                assert(i->second == d);
+                i->second = 2.5;
+                assert(i->second == 2.5);
+            }
+    }
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+            V(4, 1),
+            V(4, 1.5),
+            V(4, 2),
+            V(5, 1),
+            V(5, 1.5),
+            V(5, 2),
+            V(6, 1),
+            V(6, 1.5),
+            V(6, 2),
+            V(7, 1),
+            V(7, 1.5),
+            V(7, 2),
+            V(8, 1),
+            V(8, 1.5),
+            V(8, 2)
+        };
+        const std::multimap<int, double, std::less<int>, min_allocator<V>> 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::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= 8; ++j)
+            for (double d = 1; d <= 2; d += .5, ++i)
+            {
+                assert(i->first == j);
+                assert(i->second == d);
+            }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    { // N3644 testing
+        typedef std::multimap<int, double> 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/multimap/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/max_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/max_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// size_type max_size() const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multimap<int, double> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// explicit multimap(const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::less<int> C;
+    typedef test_allocator<std::pair<const int, double> > A;
+    std::multimap<int, double, C, A> m(A(5));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.get_allocator() == A(5));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::less<int> C;
+    typedef min_allocator<std::pair<const int, double> > A;
+    std::multimap<int, double, C, A> m(A{});
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap& operator=(initializer_list<value_type> il);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::multimap<int, double> C;
+    typedef C::value_type V;
+    C m = {{20, 1}};
+    m =
+           {
+               {1, 1},
+               {1, 1.5},
+               {1, 2},
+               {2, 1},
+               {2, 1.5},
+               {2, 2},
+               {3, 1},
+               {3, 1.5},
+               {3, 2}
+           };
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 1.5));
+    assert(*++i == V(3, 2));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+    typedef C::value_type V;
+    C m = {{20, 1}};
+    m =
+           {
+               {1, 1},
+               {1, 1.5},
+               {1, 2},
+               {2, 1},
+               {2, 1.5},
+               {2, 2},
+               {3, 1},
+               {3, 1.5},
+               {3, 2}
+           };
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 1.5));
+    assert(*++i == V(3, 2));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// explicit multimap(const key_compare& comp);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef test_compare<std::less<int> > C;
+    std::multimap<int, double, C> m(C(3));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(3));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef test_compare<std::less<int> > C;
+    std::multimap<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(3));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap(const key_compare& comp, const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<std::pair<const int, double> > A;
+    std::multimap<int, double, 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));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef test_compare<std::less<int> > C;
+    typedef min_allocator<std::pair<const int, double> > A;
+    std::multimap<int, double, C, A> m(C(4), A());
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    assert(m.key_comp() == C(4));
+    assert(m.get_allocator() == A());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap(const multimap& m);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::multimap<int, double, C, A> m = mo;
+        assert(m == mo);
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+    }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef other_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::multimap<int, double, C, A> m = mo;
+        assert(m == mo);
+        assert(m.get_allocator() == A(-2));
+        assert(m.key_comp() == C(5));
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef min_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+        std::multimap<int, double, C, A> m = mo;
+        assert(m == mo);
+        assert(m.get_allocator() == A());
+        assert(m.key_comp() == C(5));
+
+        assert(mo.get_allocator() == A());
+        assert(mo.key_comp() == C(5));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap(const multimap& m, const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<V> A;
+    std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+    std::multimap<int, double, C, A> m(mo, A(3));
+    assert(m == mo);
+    assert(m.get_allocator() == A(3));
+    assert(m.key_comp() == C(5));
+
+    assert(mo.get_allocator() == A(7));
+    assert(mo.key_comp() == C(5));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef min_allocator<V> A;
+    std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+    std::multimap<int, double, C, A> m(mo, A());
+    assert(m == mo);
+    assert(m.get_allocator() == A());
+    assert(m.key_comp() == C(5));
+
+    assert(mo.get_allocator() == A());
+    assert(mo.key_comp() == C(5));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/copy_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap& operator=(const multimap& m);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
+        std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
+        m = mo;
+        assert(m == mo);
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+
+        assert(mo.get_allocator() == A(2));
+        assert(mo.key_comp() == C(5));
+    }
+    {
+        typedef std::pair<const int, double> V;
+        const V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        std::multimap<int, double> *p = &m;
+        m = *p;
+        assert(m.size() == sizeof(ar)/sizeof(ar[0]));
+        assert(std::equal(m.begin(), m.end(), ar));
+    }
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef other_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
+        std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
+        m = mo;
+        assert(m == mo);
+        assert(m.get_allocator() == A(2));
+        assert(m.key_comp() == C(5));
+
+        assert(mo.get_allocator() == A(2));
+        assert(mo.key_comp() == C(5));
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::pair<const int, double> V;
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef min_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+        std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
+        m = mo;
+        assert(m == mo);
+        assert(m.get_allocator() == A());
+        assert(m.key_comp() == C(5));
+
+        assert(mo.get_allocator() == A());
+        assert(mo.key_comp() == C(5));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap();
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    std::multimap<int, double> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+    std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+    {
+    std::multimap<int, double> m = {};
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// multimap()
+//    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 <map>
+#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::multimap<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// ~multimap() // implied noexcept;
+
+#include <map>
+#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::multimap<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::multimap<int, double> C;
+    typedef C::value_type V;
+    C m =
+           {
+               {1, 1},
+               {1, 1.5},
+               {1, 2},
+               {2, 1},
+               {2, 1.5},
+               {2, 2},
+               {3, 1},
+               {3, 1.5},
+               {3, 2}
+           };
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 1.5));
+    assert(*++i == V(3, 2));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+    typedef C::value_type V;
+    C m =
+           {
+               {1, 1},
+               {1, 1.5},
+               {1, 2},
+               {2, 1},
+               {2, 1.5},
+               {2, 2},
+               {3, 1},
+               {3, 1.5},
+               {3, 2}
+           };
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 1.5));
+    assert(*++i == V(3, 2));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
+
+#include <map>
+#include <cassert>
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef test_compare<std::less<int> > Cmp;
+    typedef std::multimap<int, double, Cmp> C;
+    typedef C::value_type V;
+    C m(
+           {
+               {1, 1},
+               {1, 1.5},
+               {1, 2},
+               {2, 1},
+               {2, 1.5},
+               {2, 2},
+               {3, 1},
+               {3, 1.5},
+               {3, 2}
+           },
+           Cmp(4)
+        );
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 1.5));
+    assert(*++i == V(3, 2));
+    assert(m.key_comp() == Cmp(4));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef test_compare<std::less<int> > Cmp;
+    typedef std::multimap<int, double, Cmp, min_allocator<std::pair<const int, double>>> C;
+    typedef C::value_type V;
+    C m(
+           {
+               {1, 1},
+               {1, 1.5},
+               {1, 2},
+               {2, 1},
+               {2, 1.5},
+               {2, 2},
+               {3, 1},
+               {3, 1.5},
+               {3, 2}
+           },
+           Cmp(4)
+        );
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 1.5));
+    assert(*++i == V(3, 2));
+    assert(m.key_comp() == Cmp(4));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

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

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// template <class InputIterator>
+//     multimap(InputIterator first, InputIterator last);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(1, 1.5));
+    assert(*next(m.begin(), 2) == V(1, 2));
+    assert(*next(m.begin(), 3) == V(2, 1));
+    assert(*next(m.begin(), 4) == V(2, 1.5));
+    assert(*next(m.begin(), 5) == V(2, 2));
+    assert(*next(m.begin(), 6) == V(3, 1));
+    assert(*next(m.begin(), 7) == V(3, 1.5));
+    assert(*next(m.begin(), 8) == V(3, 2));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(1, 1.5));
+    assert(*next(m.begin(), 2) == V(1, 2));
+    assert(*next(m.begin(), 3) == V(2, 1));
+    assert(*next(m.begin(), 4) == V(2, 1.5));
+    assert(*next(m.begin(), 5) == V(2, 2));
+    assert(*next(m.begin(), 6) == V(3, 1));
+    assert(*next(m.begin(), 7) == V(3, 1.5));
+    assert(*next(m.begin(), 8) == V(3, 2));
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef min_allocator<std::pair<const int, double>> A;
+    A a;
+    std::multimap<int, double, std::less<int>, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(1, 1.5));
+    assert(*next(m.begin(), 2) == V(1, 2));
+    assert(*next(m.begin(), 3) == V(2, 1));
+    assert(*next(m.begin(), 4) == V(2, 1.5));
+    assert(*next(m.begin(), 5) == V(2, 2));
+    assert(*next(m.begin(), 6) == V(3, 1));
+    assert(*next(m.begin(), 7) == V(3, 1.5));
+    assert(*next(m.begin(), 8) == V(3, 2));
+    assert(m.get_allocator() == a);
+    }
+#endif
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// template <class InputIterator>
+//     multimap(InputIterator first, InputIterator last,
+//              const key_compare& comp);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    std::multimap<int, double, C> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(1, 1.5));
+    assert(*next(m.begin(), 2) == V(1, 2));
+    assert(*next(m.begin(), 3) == V(2, 1));
+    assert(*next(m.begin(), 4) == V(2, 1.5));
+    assert(*next(m.begin(), 5) == V(2, 2));
+    assert(*next(m.begin(), 6) == V(3, 1));
+    assert(*next(m.begin(), 7) == V(3, 1.5));
+    assert(*next(m.begin(), 8) == V(3, 2));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    std::multimap<int, double, C, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(1, 1.5));
+    assert(*next(m.begin(), 2) == V(1, 2));
+    assert(*next(m.begin(), 3) == V(2, 1));
+    assert(*next(m.begin(), 4) == V(2, 1.5));
+    assert(*next(m.begin(), 5) == V(2, 2));
+    assert(*next(m.begin(), 6) == V(3, 1));
+    assert(*next(m.begin(), 7) == V(3, 1.5));
+    assert(*next(m.begin(), 8) == V(3, 2));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// template <class InputIterator>
+//     multimap(InputIterator first, InputIterator last,
+//              const key_compare& comp, const allocator_type& a);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef test_allocator<V> A;
+    std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+    assert(m.get_allocator() == A(7));
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(1, 1.5));
+    assert(*next(m.begin(), 2) == V(1, 2));
+    assert(*next(m.begin(), 3) == V(2, 1));
+    assert(*next(m.begin(), 4) == V(2, 1.5));
+    assert(*next(m.begin(), 5) == V(2, 2));
+    assert(*next(m.begin(), 6) == V(3, 1));
+    assert(*next(m.begin(), 7) == V(3, 1.5));
+    assert(*next(m.begin(), 8) == V(3, 2));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::pair<const int, double> V;
+    V ar[] =
+    {
+        V(1, 1),
+        V(1, 1.5),
+        V(1, 2),
+        V(2, 1),
+        V(2, 1.5),
+        V(2, 2),
+        V(3, 1),
+        V(3, 1.5),
+        V(3, 2),
+    };
+    typedef test_compare<std::less<int> > C;
+    typedef min_allocator<V> A;
+    std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+    assert(m.get_allocator() == A());
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*m.begin() == V(1, 1));
+    assert(*next(m.begin()) == V(1, 1.5));
+    assert(*next(m.begin(), 2) == V(1, 2));
+    assert(*next(m.begin(), 3) == V(2, 1));
+    assert(*next(m.begin(), 4) == V(2, 1.5));
+    assert(*next(m.begin(), 5) == V(2, 2));
+    assert(*next(m.begin(), 6) == V(3, 1));
+    assert(*next(m.begin(), 7) == V(3, 1.5));
+    assert(*next(m.begin(), 8) == V(3, 2));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,132 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap(multimap&& m);
+
+#include <map>
+#include <cassert>
+
+#include "../../../test_compare.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    typedef std::pair<const int, double> V;
+    {
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::multimap<int, double, C, A> mo(C(5), A(7));
+        std::multimap<int, double, 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);
+    }
+    {
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef test_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::multimap<int, double, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*m.begin() == V(1, 1));
+        assert(*next(m.begin()) == V(1, 1.5));
+        assert(*next(m.begin(), 2) == V(1, 2));
+        assert(*next(m.begin(), 3) == V(2, 1));
+        assert(*next(m.begin(), 4) == V(2, 1.5));
+        assert(*next(m.begin(), 5) == V(2, 2));
+        assert(*next(m.begin(), 6) == V(3, 1));
+        assert(*next(m.begin(), 7) == V(3, 1.5));
+        assert(*next(m.begin(), 8) == V(3, 2));
+
+        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 test_compare<std::less<int> > C;
+        typedef min_allocator<V> A;
+        std::multimap<int, double, C, A> mo(C(5), A());
+        std::multimap<int, double, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A());
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 0);
+        assert(distance(m.begin(), m.end()) == 0);
+
+        assert(mo.get_allocator() == A());
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 0);
+        assert(distance(mo.begin(), mo.end()) == 0);
+    }
+    {
+        V ar[] =
+        {
+            V(1, 1),
+            V(1, 1.5),
+            V(1, 2),
+            V(2, 1),
+            V(2, 1.5),
+            V(2, 2),
+            V(3, 1),
+            V(3, 1.5),
+            V(3, 2),
+        };
+        typedef test_compare<std::less<int> > C;
+        typedef min_allocator<V> A;
+        std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+        std::multimap<int, double, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A());
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*m.begin() == V(1, 1));
+        assert(*next(m.begin()) == V(1, 1.5));
+        assert(*next(m.begin(), 2) == V(1, 2));
+        assert(*next(m.begin(), 3) == V(2, 1));
+        assert(*next(m.begin(), 4) == V(2, 1.5));
+        assert(*next(m.begin(), 5) == V(2, 2));
+        assert(*next(m.begin(), 6) == V(3, 1));
+        assert(*next(m.begin(), 7) == V(3, 1.5));
+        assert(*next(m.begin(), 8) == V(3, 2));
+
+        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/multimap/multimap.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap(multimap&& m, const allocator_type& a);
+
+#include <map>
+#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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef other_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef min_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+        M m3(std::move(m1), A());
+        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/multimap/multimap.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// multimap& operator=(multimap&& m);
+
+#include <map>
+#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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef test_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef other_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7));
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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 std::pair<MoveOnly, MoveOnly> V;
+        typedef std::pair<const MoveOnly, MoveOnly> VC;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef min_allocator<VC> A;
+        typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+        typedef std::move_iterator<V*> I;
+        V a1[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 3)
+        };
+        M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+        V a2[] =
+        {
+            V(1, 1),
+            V(1, 2),
+            V(1, 3),
+            V(2, 1),
+            V(2, 2),
+            V(2, 3),
+            V(3, 1),
+            V(3, 2),
+            V(3, 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/multimap/multimap.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// multimap& operator=(multimap&& 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 <map>
+#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::multimap<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// multimap(multimap&&)
+//        noexcept(is_nothrow_move_constructible<allocator_type>::value &&
+//                 is_nothrow_move_constructible<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <map>
+#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::multimap<MoveOnly, MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// void clear();
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multimap<int, double> M;
+        typedef std::pair<int, double> P;
+        P ar[] =
+        {
+            P(1, 1.5),
+            P(2, 2.5),
+            P(3, 3.5),
+            P(4, 4.5),
+            P(5, 5.5),
+            P(6, 6.5),
+            P(7, 7.5),
+            P(8, 8.5),
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        m.clear();
+        assert(m.size() == 0);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef std::pair<int, double> P;
+        P ar[] =
+        {
+            P(1, 1.5),
+            P(2, 2.5),
+            P(3, 3.5),
+            P(4, 4.5),
+            P(5, 5.5),
+            P(6, 6.5),
+            P(7, 7.5),
+            P(8, 8.5),
+        };
+        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/multimap/multimap.modifiers/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,150 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// template <class... Args>
+//   iterator emplace(Args&&... args);
+
+#include <map>
+#include <cassert>
+
+#include "../../../Emplaceable.h"
+#include "DefaultOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::multimap<int, DefaultOnly> M;
+        typedef M::iterator R;
+        M m;
+        assert(DefaultOnly::count == 0);
+        R r = m.emplace();
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 0);
+        assert(m.begin()->second == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(r == next(m.begin()));
+        assert(m.size() == 2);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(r == next(m.begin(), 2));
+        assert(m.size() == 3);
+        assert(next(m.begin(), 2)->first == 1);
+        assert(next(m.begin(), 2)->second == DefaultOnly());
+        assert(DefaultOnly::count == 3);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::multimap<int, Emplaceable> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
+                                                  std::forward_as_tuple());
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == Emplaceable());
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(2, 3.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == Emplaceable(2, 3.5));
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(3, 3.5));
+        assert(r == next(m.begin()));
+        assert(m.size() == 3);
+        assert(r->first == 1);
+        assert(r->second == Emplaceable(3, 3.5));
+    }
+    {
+        typedef std::multimap<int, double> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace(M::value_type(2, 3.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == 3.5);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+        typedef M::iterator R;
+        M m;
+        assert(DefaultOnly::count == 0);
+        R r = m.emplace();
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 0);
+        assert(m.begin()->second == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(r == next(m.begin()));
+        assert(m.size() == 2);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple());
+        assert(r == next(m.begin(), 2));
+        assert(m.size() == 3);
+        assert(next(m.begin(), 2)->first == 1);
+        assert(next(m.begin(), 2)->second == DefaultOnly());
+        assert(DefaultOnly::count == 3);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2),
+                                                  std::forward_as_tuple());
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == Emplaceable());
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(2, 3.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == Emplaceable(2, 3.5));
+        r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+                                                std::forward_as_tuple(3, 3.5));
+        assert(r == next(m.begin()));
+        assert(m.size() == 3);
+        assert(r->first == 1);
+        assert(r->second == Emplaceable(3, 3.5));
+    }
+    {
+        typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace(M::value_type(2, 3.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(m.begin()->first == 2);
+        assert(m.begin()->second == 3.5);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

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

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,279 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// iterator erase(const_iterator position);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multimap<int, double> M;
+        typedef std::pair<int, double> P;
+        typedef M::iterator I;
+        P ar[] =
+        {
+            P(1, 1),
+            P(1, 1.5),
+            P(1, 2),
+            P(2, 1),
+            P(2, 1.5),
+            P(2, 2),
+            P(3, 1),
+            P(3, 1.5),
+            P(3, 2),
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 9);
+        I i = m.erase(next(m.cbegin(), 3));
+        assert(m.size() == 8);
+        assert(i == next(m.begin(), 3));
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == 1);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == 1.5);
+        assert(next(m.begin(), 2)->first == 1);
+        assert(next(m.begin(), 2)->second == 2);
+        assert(next(m.begin(), 3)->first == 2);
+        assert(next(m.begin(), 3)->second == 1.5);
+        assert(next(m.begin(), 4)->first == 2);
+        assert(next(m.begin(), 4)->second == 2);
+        assert(next(m.begin(), 5)->first == 3);
+        assert(next(m.begin(), 5)->second == 1);
+        assert(next(m.begin(), 6)->first == 3);
+        assert(next(m.begin(), 6)->second == 1.5);
+        assert(next(m.begin(), 7)->first == 3);
+        assert(next(m.begin(), 7)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 7);
+        assert(i == m.begin());
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 1);
+        assert(next(m.begin(), 1)->second == 2);
+        assert(next(m.begin(), 2)->first == 2);
+        assert(next(m.begin(), 2)->second == 1.5);
+        assert(next(m.begin(), 3)->first == 2);
+        assert(next(m.begin(), 3)->second == 2);
+        assert(next(m.begin(), 4)->first == 3);
+        assert(next(m.begin(), 4)->second == 1);
+        assert(next(m.begin(), 5)->first == 3);
+        assert(next(m.begin(), 5)->second == 1.5);
+        assert(next(m.begin(), 6)->first == 3);
+        assert(next(m.begin(), 6)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 5));
+        assert(m.size() == 6);
+        assert(i == prev(m.end()));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 1);
+        assert(next(m.begin(), 1)->second == 2);
+        assert(next(m.begin(), 2)->first == 2);
+        assert(next(m.begin(), 2)->second == 1.5);
+        assert(next(m.begin(), 3)->first == 2);
+        assert(next(m.begin(), 3)->second == 2);
+        assert(next(m.begin(), 4)->first == 3);
+        assert(next(m.begin(), 4)->second == 1);
+        assert(next(m.begin(), 5)->first == 3);
+        assert(next(m.begin(), 5)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 1));
+        assert(m.size() == 5);
+        assert(i == next(m.begin()));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 2);
+        assert(next(m.begin(), 1)->second == 1.5);
+        assert(next(m.begin(), 2)->first == 2);
+        assert(next(m.begin(), 2)->second == 2);
+        assert(next(m.begin(), 3)->first == 3);
+        assert(next(m.begin(), 3)->second == 1);
+        assert(next(m.begin(), 4)->first == 3);
+        assert(next(m.begin(), 4)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 4);
+        assert(i == next(m.begin(), 2));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 2);
+        assert(next(m.begin(), 1)->second == 1.5);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 1);
+        assert(next(m.begin(), 3)->first == 3);
+        assert(next(m.begin(), 3)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 3);
+        assert(i == next(m.begin(), 2));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 2);
+        assert(next(m.begin(), 1)->second == 1.5);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 0));
+        assert(next(m.begin(), 0)->first == 2);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 3);
+        assert(next(m.begin(), 1)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 1));
+        assert(m.size() == 1);
+        assert(i == m.end());
+        assert(next(m.begin(), 0)->first == 2);
+        assert(next(m.begin(), 0)->second == 1.5);
+
+        i = m.erase(m.cbegin());
+        assert(m.size() == 0);
+        assert(i == m.begin());
+        assert(i == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef std::pair<int, double> P;
+        typedef M::iterator I;
+        P ar[] =
+        {
+            P(1, 1),
+            P(1, 1.5),
+            P(1, 2),
+            P(2, 1),
+            P(2, 1.5),
+            P(2, 2),
+            P(3, 1),
+            P(3, 1.5),
+            P(3, 2),
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 9);
+        I i = m.erase(next(m.cbegin(), 3));
+        assert(m.size() == 8);
+        assert(i == next(m.begin(), 3));
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == 1);
+        assert(next(m.begin())->first == 1);
+        assert(next(m.begin())->second == 1.5);
+        assert(next(m.begin(), 2)->first == 1);
+        assert(next(m.begin(), 2)->second == 2);
+        assert(next(m.begin(), 3)->first == 2);
+        assert(next(m.begin(), 3)->second == 1.5);
+        assert(next(m.begin(), 4)->first == 2);
+        assert(next(m.begin(), 4)->second == 2);
+        assert(next(m.begin(), 5)->first == 3);
+        assert(next(m.begin(), 5)->second == 1);
+        assert(next(m.begin(), 6)->first == 3);
+        assert(next(m.begin(), 6)->second == 1.5);
+        assert(next(m.begin(), 7)->first == 3);
+        assert(next(m.begin(), 7)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 7);
+        assert(i == m.begin());
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 1);
+        assert(next(m.begin(), 1)->second == 2);
+        assert(next(m.begin(), 2)->first == 2);
+        assert(next(m.begin(), 2)->second == 1.5);
+        assert(next(m.begin(), 3)->first == 2);
+        assert(next(m.begin(), 3)->second == 2);
+        assert(next(m.begin(), 4)->first == 3);
+        assert(next(m.begin(), 4)->second == 1);
+        assert(next(m.begin(), 5)->first == 3);
+        assert(next(m.begin(), 5)->second == 1.5);
+        assert(next(m.begin(), 6)->first == 3);
+        assert(next(m.begin(), 6)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 5));
+        assert(m.size() == 6);
+        assert(i == prev(m.end()));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 1);
+        assert(next(m.begin(), 1)->second == 2);
+        assert(next(m.begin(), 2)->first == 2);
+        assert(next(m.begin(), 2)->second == 1.5);
+        assert(next(m.begin(), 3)->first == 2);
+        assert(next(m.begin(), 3)->second == 2);
+        assert(next(m.begin(), 4)->first == 3);
+        assert(next(m.begin(), 4)->second == 1);
+        assert(next(m.begin(), 5)->first == 3);
+        assert(next(m.begin(), 5)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 1));
+        assert(m.size() == 5);
+        assert(i == next(m.begin()));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 2);
+        assert(next(m.begin(), 1)->second == 1.5);
+        assert(next(m.begin(), 2)->first == 2);
+        assert(next(m.begin(), 2)->second == 2);
+        assert(next(m.begin(), 3)->first == 3);
+        assert(next(m.begin(), 3)->second == 1);
+        assert(next(m.begin(), 4)->first == 3);
+        assert(next(m.begin(), 4)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 4);
+        assert(i == next(m.begin(), 2));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 2);
+        assert(next(m.begin(), 1)->second == 1.5);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 1);
+        assert(next(m.begin(), 3)->first == 3);
+        assert(next(m.begin(), 3)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 2));
+        assert(m.size() == 3);
+        assert(i == next(m.begin(), 2));
+        assert(next(m.begin(), 0)->first == 1);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 2);
+        assert(next(m.begin(), 1)->second == 1.5);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 0));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 0));
+        assert(next(m.begin(), 0)->first == 2);
+        assert(next(m.begin(), 0)->second == 1.5);
+        assert(next(m.begin(), 1)->first == 3);
+        assert(next(m.begin(), 1)->second == 2);
+
+        i = m.erase(next(m.cbegin(), 1));
+        assert(m.size() == 1);
+        assert(i == m.end());
+        assert(next(m.begin(), 0)->first == 2);
+        assert(next(m.begin(), 0)->second == 1.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/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// iterator erase(const_iterator first, const_iterator last);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multimap<int, double> M;
+        typedef std::pair<int, double> P;
+        typedef M::iterator I;
+        P ar[] =
+        {
+            P(1, 1.5),
+            P(2, 2.5),
+            P(3, 3.5),
+            P(4, 4.5),
+            P(5, 5.5),
+            P(6, 6.5),
+            P(7, 7.5),
+            P(8, 8.5),
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(m.cbegin(), m.cbegin());
+        assert(m.size() == 8);
+        assert(i == m.begin());
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == 1.5);
+        assert(next(m.begin())->first == 2);
+        assert(next(m.begin())->second == 2.5);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 3.5);
+        assert(next(m.begin(), 3)->first == 4);
+        assert(next(m.begin(), 3)->second == 4.5);
+        assert(next(m.begin(), 4)->first == 5);
+        assert(next(m.begin(), 4)->second == 5.5);
+        assert(next(m.begin(), 5)->first == 6);
+        assert(next(m.begin(), 5)->second == 6.5);
+        assert(next(m.begin(), 6)->first == 7);
+        assert(next(m.begin(), 6)->second == 7.5);
+        assert(next(m.begin(), 7)->first == 8);
+        assert(next(m.begin(), 7)->second == 8.5);
+
+        i = m.erase(m.cbegin(), next(m.cbegin(), 2));
+        assert(m.size() == 6);
+        assert(i == m.begin());
+        assert(next(m.begin(), 0)->first == 3);
+        assert(next(m.begin(), 0)->second == 3.5);
+        assert(next(m.begin(), 1)->first == 4);
+        assert(next(m.begin(), 1)->second == 4.5);
+        assert(next(m.begin(), 2)->first == 5);
+        assert(next(m.begin(), 2)->second == 5.5);
+        assert(next(m.begin(), 3)->first == 6);
+        assert(next(m.begin(), 3)->second == 6.5);
+        assert(next(m.begin(), 4)->first == 7);
+        assert(next(m.begin(), 4)->second == 7.5);
+        assert(next(m.begin(), 5)->first == 8);
+        assert(next(m.begin(), 5)->second == 8.5);
+
+        i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 2));
+        assert(next(m.begin(), 0)->first == 3);
+        assert(next(m.begin(), 0)->second == 3.5);
+        assert(next(m.begin(), 1)->first == 4);
+        assert(next(m.begin(), 1)->second == 4.5);
+
+        i = m.erase(m.cbegin(), m.cend());
+        assert(m.size() == 0);
+        assert(i == m.begin());
+        assert(i == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef std::pair<int, double> P;
+        typedef M::iterator I;
+        P ar[] =
+        {
+            P(1, 1.5),
+            P(2, 2.5),
+            P(3, 3.5),
+            P(4, 4.5),
+            P(5, 5.5),
+            P(6, 6.5),
+            P(7, 7.5),
+            P(8, 8.5),
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 8);
+        I i = m.erase(m.cbegin(), m.cbegin());
+        assert(m.size() == 8);
+        assert(i == m.begin());
+        assert(m.begin()->first == 1);
+        assert(m.begin()->second == 1.5);
+        assert(next(m.begin())->first == 2);
+        assert(next(m.begin())->second == 2.5);
+        assert(next(m.begin(), 2)->first == 3);
+        assert(next(m.begin(), 2)->second == 3.5);
+        assert(next(m.begin(), 3)->first == 4);
+        assert(next(m.begin(), 3)->second == 4.5);
+        assert(next(m.begin(), 4)->first == 5);
+        assert(next(m.begin(), 4)->second == 5.5);
+        assert(next(m.begin(), 5)->first == 6);
+        assert(next(m.begin(), 5)->second == 6.5);
+        assert(next(m.begin(), 6)->first == 7);
+        assert(next(m.begin(), 6)->second == 7.5);
+        assert(next(m.begin(), 7)->first == 8);
+        assert(next(m.begin(), 7)->second == 8.5);
+
+        i = m.erase(m.cbegin(), next(m.cbegin(), 2));
+        assert(m.size() == 6);
+        assert(i == m.begin());
+        assert(next(m.begin(), 0)->first == 3);
+        assert(next(m.begin(), 0)->second == 3.5);
+        assert(next(m.begin(), 1)->first == 4);
+        assert(next(m.begin(), 1)->second == 4.5);
+        assert(next(m.begin(), 2)->first == 5);
+        assert(next(m.begin(), 2)->second == 5.5);
+        assert(next(m.begin(), 3)->first == 6);
+        assert(next(m.begin(), 3)->second == 6.5);
+        assert(next(m.begin(), 4)->first == 7);
+        assert(next(m.begin(), 4)->second == 7.5);
+        assert(next(m.begin(), 5)->first == 8);
+        assert(next(m.begin(), 5)->second == 8.5);
+
+        i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6));
+        assert(m.size() == 2);
+        assert(i == next(m.begin(), 2));
+        assert(next(m.begin(), 0)->first == 3);
+        assert(next(m.begin(), 0)->second == 3.5);
+        assert(next(m.begin(), 1)->first == 4);
+        assert(next(m.begin(), 1)->second == 4.5);
+
+        i = m.erase(m.cbegin(), m.cend());
+        assert(m.size() == 0);
+        assert(i == m.begin());
+        assert(i == m.end());
+    }
+#endif
+}

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

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// iterator insert(const value_type& v);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multimap<int, double> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2, 2.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2.5);
+
+        r = m.insert(M::value_type(1, 1.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2, 2.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2.5);
+
+        r = m.insert(M::value_type(1, 1.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+
+        r = m.insert(M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// void insert(initializer_list<value_type> il);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::multimap<int, double> C;
+    typedef C::value_type V;
+    C m =
+           {
+               {1, 1},
+               {1, 2},
+               {2, 1},
+               {2, 2},
+               {3, 1},
+               {3, 2}
+           };
+    m.insert(
+               {
+                   {1, 1.5},
+                   {2, 1.5},
+                   {3, 1.5},
+               }
+            );
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 2));
+    assert(*++i == V(3, 1.5));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+    typedef C::value_type V;
+    C m =
+           {
+               {1, 1},
+               {1, 2},
+               {2, 1},
+               {2, 2},
+               {3, 1},
+               {3, 2}
+           };
+    m.insert(
+               {
+                   {1, 1.5},
+                   {2, 1.5},
+                   {3, 1.5},
+               }
+            );
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    C::const_iterator i = m.cbegin();
+    assert(*i == V(1, 1));
+    assert(*++i == V(1, 2));
+    assert(*++i == V(1, 1.5));
+    assert(*++i == V(2, 1));
+    assert(*++i == V(2, 2));
+    assert(*++i == V(2, 1.5));
+    assert(*++i == V(3, 1));
+    assert(*++i == V(3, 2));
+    assert(*++i == V(3, 1.5));
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// iterator insert(const_iterator position, const value_type& v);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multimap<int, double> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.end(), M::value_type(2, 2.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2.5);
+
+        r = m.insert(m.end(), M::value_type(1, 1.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1.5);
+
+        r = m.insert(m.end(), M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+
+        r = m.insert(prev(m.end()), M::value_type(3, 4.5));
+        assert(r == prev(m.end(), 2));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 4.5);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.end(), M::value_type(2, 2.5));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2.5);
+
+        r = m.insert(m.end(), M::value_type(1, 1.5));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1.5);
+
+        r = m.insert(m.end(), M::value_type(3, 3.5));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3.5);
+
+        r = m.insert(prev(m.end()), M::value_type(3, 4.5));
+        assert(r == prev(m.end(), 2));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 4.5);
+    }
+#endif
+}

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

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// template <class P>
+//     iterator insert(const_iterator position, P&& p);
+
+#include <map>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::multimap<int, MoveOnly> M;
+        typedef std::pair<int, MoveOnly> P;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.cend(), P(2, 2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2);
+
+        r = m.insert(m.cend(), P(1, 1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1);
+
+        r = m.insert(m.cend(), P(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+
+        r = m.insert(m.cend(), P(3, 2));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+        typedef std::pair<int, MoveOnly> P;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(m.cend(), P(2, 2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2);
+
+        r = m.insert(m.cend(), P(1, 1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1);
+
+        r = m.insert(m.cend(), P(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+
+        r = m.insert(m.cend(), P(3, 2));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 2);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// template <class P>
+//   iterator insert(P&& p);
+
+#include <map>
+#include <cassert>
+
+#include "../../../MoveOnly.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        typedef std::multimap<int, MoveOnly> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2, 2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2);
+
+        r = m.insert(M::value_type(1, 1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1);
+
+        r = m.insert(M::value_type(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+
+        r = m.insert(M::value_type(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2, 2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(r->first == 2);
+        assert(r->second == 2);
+
+        r = m.insert(M::value_type(1, 1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(r->first == 1);
+        assert(r->second == 1);
+
+        r = m.insert(M::value_type(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(r->first == 3);
+        assert(r->second == 3);
+
+        r = m.insert(M::value_type(3, 3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(r->first == 3);
+        assert(r->second == 3);
+    }
+#endif
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// size_type count(const key_type& k) const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+#include "private_constructor.hpp"
+
+int main()
+{
+    typedef std::pair<const int, double> V;
+    {
+    typedef std::multimap<int, double> M;
+    {
+        typedef M::size_type R;
+        V ar[] =
+        {
+            V(5, 1),
+            V(5, 2),
+            V(5, 3),
+            V(7, 1),
+            V(7, 2),
+            V(7, 3),
+            V(9, 1),
+            V(9, 2),
+            V(9, 3)
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(4);
+        assert(r == 0);
+        r = m.count(5);
+        assert(r == 3);
+        r = m.count(6);
+        assert(r == 0);
+        r = m.count(7);
+        assert(r == 3);
+        r = m.count(8);
+        assert(r == 0);
+        r = m.count(9);
+        assert(r == 3);
+        r = m.count(10);
+        assert(r == 0);
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+    {
+        typedef M::size_type R;
+        V ar[] =
+        {
+            V(5, 1),
+            V(5, 2),
+            V(5, 3),
+            V(7, 1),
+            V(7, 2),
+            V(7, 3),
+            V(9, 1),
+            V(9, 2),
+            V(9, 3)
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(4);
+        assert(r == 0);
+        r = m.count(5);
+        assert(r == 3);
+        r = m.count(6);
+        assert(r == 0);
+        r = m.count(7);
+        assert(r == 3);
+        r = m.count(8);
+        assert(r == 0);
+        r = m.count(9);
+        assert(r == 3);
+        r = m.count(10);
+        assert(r == 0);
+    }
+    }
+#endif
+
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::multimap<int, double, std::less<>> M;
+    typedef M::size_type R;
+    V ar[] =
+    {
+        V(5, 1),
+        V(5, 2),
+        V(5, 3),
+        V(7, 1),
+        V(7, 2),
+        V(7, 3),
+        V(9, 1),
+        V(9, 2),
+        V(9, 3)
+    };
+    const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 3);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 3);
+    r = m.count(10);
+    assert(r == 0);
+    }
+
+    {
+    typedef PrivateConstructor PC;
+    typedef std::multimap<PC, double, std::less<>> M;
+    typedef M::size_type R;
+
+    M m;
+    m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 3);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 3);
+    r = m.count(10);
+    assert(r == 0);
+    }
+#endif
+}

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

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

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

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

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,200 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// void swap(multimap& m);
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    typedef std::pair<const int, double> V;
+    {
+    typedef std::multimap<int, double> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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/multimap/multimap.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,305 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// template <class Key, class T, class Compare, class Allocator>
+//   void
+//   swap(multimap<Key, T, Compare, Allocator>& x, multimap<Key, T, Compare, Allocator>& y);
+
+#include <map>
+#include <cassert>
+#include "test_allocator.h"
+#include "../../../test_compare.h"
+#include "min_allocator.h"
+
+int main()
+{
+    typedef std::pair<const int, double> V;
+    {
+    typedef std::multimap<int, double> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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::multimap<int, double, C, A> M;
+        V ar1[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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::multimap<int, double, C, A> M;
+        V ar1[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> 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[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 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[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 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 min_allocator<V> A;
+        typedef test_compare<std::less<int> > C;
+        typedef std::multimap<int, double, C, A> M;
+        V ar1[] =
+        {
+            V(1, 1),
+            V(2, 2),
+            V(3, 3),
+            V(4, 4)
+        };
+        V ar2[] =
+        {
+            V(5, 5),
+            V(6, 6),
+            V(7, 7),
+            V(8, 8),
+            V(9, 9),
+            V(10, 10),
+            V(11, 11),
+            V(12, 12)
+        };
+        M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
+        M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
+        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());
+        assert(m2.key_comp() == C(1));
+        assert(m2.get_allocator() == A());
+    }
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// void swap(multimap& c)
+//     noexcept(!allocator_type::propagate_on_container_swap::value ||
+//              __is_nothrow_swappable<allocator_type>::value);
+
+// This tests a conforming extension
+
+#include <map>
+#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::multimap<MoveOnly, MoveOnly> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        C c1, c2;
+        static_assert(noexcept(swap(c1, c2)), "");
+    }
+    {
+        typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
+        C c1, c2;
+        static_assert(!noexcept(swap(c1, c2)), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/scary.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/scary.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/scary.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map class multimap
+
+// Extension:  SCARY/N2913 iterator compatibility between map and multimap
+
+#include <map>
+
+int main()
+{
+    typedef std::map<int, int> M1;
+    typedef std::multimap<int, int> M2;
+    M2::iterator i;
+    M1::iterator j = i;
+}

Added: libcxx/trunk/test/std/containers/associative/multimap/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class multimap
+
+// size_type size() const;
+
+#include <map>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multimap<int, double> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2, 1.5));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1, 1.5));
+    assert(m.size() == 2);
+    m.insert(M::value_type(3, 1.5));
+    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::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+    M m;
+    assert(m.size() == 0);
+    m.insert(M::value_type(2, 1.5));
+    assert(m.size() == 1);
+    m.insert(M::value_type(1, 1.5));
+    assert(m.size() == 2);
+    m.insert(M::value_type(3, 1.5));
+    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/multimap/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/types.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multimap/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// template <class Key, class T, class Compare = less<Key>,
+//           class Allocator = allocator<pair<const Key, T>>>
+// class multimap
+// {
+// public:
+//     // types:
+//     typedef Key                                      key_type;
+//     typedef T                                        mapped_type;
+//     typedef pair<const key_type, mapped_type>        value_type;
+//     typedef Compare                                  key_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 <map>
+#include <type_traits>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multimap<int, double> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::mapped_type, double>::value), "");
+    static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, std::allocator<std::pair<const int, double> > >::value), "");
+    static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::pointer, std::pair<const int, double>*>::value), "");
+    static_assert((std::is_same<C::const_pointer, const std::pair<const int, double>*>::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::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+    static_assert((std::is_same<C::key_type, int>::value), "");
+    static_assert((std::is_same<C::mapped_type, double>::value), "");
+    static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
+    static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
+    static_assert((std::is_same<C::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
+    static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), "");
+    static_assert((std::is_same<C::pointer, min_pointer<std::pair<const int, double>>>::value), "");
+    static_assert((std::is_same<C::const_pointer, min_pointer<const std::pair<const int, double>>>::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/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// void clear();
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multiset<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::multiset<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/multiset/count.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/count.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/count.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/count.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,160 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 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::multiset<int> M;
+    {
+        typedef M::size_type R;
+        V ar[] =
+        {
+            5,
+            5,
+            5,
+            5,
+            7,
+            7,
+            7,
+            9,
+            9
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(4);
+        assert(r == 0);
+        r = m.count(5);
+        assert(r == 4);
+        r = m.count(6);
+        assert(r == 0);
+        r = m.count(7);
+        assert(r == 3);
+        r = m.count(8);
+        assert(r == 0);
+        r = m.count(9);
+        assert(r == 2);
+        r = m.count(10);
+        assert(r == 0);
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+    {
+        typedef M::size_type R;
+        V ar[] =
+        {
+            5,
+            5,
+            5,
+            5,
+            7,
+            7,
+            7,
+            9,
+            9
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(4);
+        assert(r == 0);
+        r = m.count(5);
+        assert(r == 4);
+        r = m.count(6);
+        assert(r == 0);
+        r = m.count(7);
+        assert(r == 3);
+        r = m.count(8);
+        assert(r == 0);
+        r = m.count(9);
+        assert(r == 2);
+        r = m.count(10);
+        assert(r == 0);
+    }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::multiset<int, std::less<>> M;
+    typedef M::size_type R;
+    V ar[] =
+    {
+        5,
+        5,
+        5,
+        5,
+        7,
+        7,
+        7,
+        9,
+        9
+    };
+    const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 4);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 2);
+    r = m.count(10);
+    assert(r == 0);
+    }
+
+    {
+    typedef PrivateConstructor V;
+    typedef std::multiset<V, std::less<>> M;
+    typedef M::size_type R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    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 ));
+
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 4);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 2);
+    r = m.count(10);
+    assert(r == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/emplace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/emplace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/emplace.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/emplace.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 multiset
+
+// template <class... Args>
+//   iterator 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::multiset<DefaultOnly> M;
+        typedef M::iterator R;
+        M m;
+        assert(DefaultOnly::count == 0);
+        R r = m.emplace();
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == DefaultOnly());
+        assert(DefaultOnly::count == 1);
+
+        r = m.emplace();
+        assert(r == next(m.begin()));
+        assert(m.size() == 2);
+        assert(*m.begin() == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::multiset<Emplaceable> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace();
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*m.begin() == Emplaceable());
+        r = m.emplace(2, 3.5);
+        assert(r == next(m.begin()));
+        assert(m.size() == 2);
+        assert(*r == Emplaceable(2, 3.5));
+        r = m.emplace(2, 3.5);
+        assert(r == next(m.begin(), 2));
+        assert(m.size() == 3);
+        assert(*r == Emplaceable(2, 3.5));
+    }
+    {
+        typedef std::multiset<int> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace(M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.emplace(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/multiset/emplace_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/emplace_hint.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/emplace_hint.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// 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::multiset<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() == 2);
+        assert(*m.begin() == DefaultOnly());
+        assert(DefaultOnly::count == 2);
+    }
+    assert(DefaultOnly::count == 0);
+    {
+        typedef std::multiset<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() == 3);
+        assert(*r == Emplaceable(2, 3.5));
+    }
+    {
+        typedef std::multiset<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::multiset<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/multiset/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// bool empty() const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multiset<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::multiset<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/multiset/equal_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,263 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// 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::multiset<int> M;
+    {
+        typedef std::pair<M::iterator, 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.equal_range(4);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 0));
+        r = m.equal_range(5);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(6);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(7);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(8);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(9);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 9));
+        r = m.equal_range(10);
+        assert(r.first  == next(m.begin(), 9));
+        assert(r.second == next(m.begin(), 9));
+    }
+    {
+        typedef std::pair<M::const_iterator, M::const_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.equal_range(4);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 0));
+        r = m.equal_range(5);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(6);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(7);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(8);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(9);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 9));
+        r = m.equal_range(10);
+        assert(r.first  == next(m.begin(), 9));
+        assert(r.second == next(m.begin(), 9));
+    }
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+    {
+        typedef std::pair<M::iterator, 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.equal_range(4);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 0));
+        r = m.equal_range(5);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(6);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(7);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(8);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(9);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 9));
+        r = m.equal_range(10);
+        assert(r.first  == next(m.begin(), 9));
+        assert(r.second == next(m.begin(), 9));
+    }
+    {
+        typedef std::pair<M::const_iterator, M::const_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.equal_range(4);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 0));
+        r = m.equal_range(5);
+        assert(r.first  == next(m.begin(), 0));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(6);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 3));
+        r = m.equal_range(7);
+        assert(r.first  == next(m.begin(), 3));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(8);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 6));
+        r = m.equal_range(9);
+        assert(r.first  == next(m.begin(), 6));
+        assert(r.second == next(m.begin(), 9));
+        r = m.equal_range(10);
+        assert(r.first  == next(m.begin(), 9));
+        assert(r.second == next(m.begin(), 9));
+    }
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::multiset<V, std::less<>> M;
+    typedef std::pair<M::iterator, 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.equal_range(4);
+    assert(r.first  == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 0));
+    r = m.equal_range(5);
+    assert(r.first  == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(6);
+    assert(r.first  == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(7);
+    assert(r.first  == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(8);
+    assert(r.first  == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(9);
+    assert(r.first  == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 9));
+    r = m.equal_range(10);
+    assert(r.first  == next(m.begin(), 9));
+    assert(r.second == next(m.begin(), 9));
+    }
+
+    {
+    typedef PrivateConstructor V;
+    typedef std::multiset<V, std::less<>> M;
+    typedef std::pair<M::iterator, 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.equal_range(4);
+    assert(r.first  == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 0));
+    r = m.equal_range(5);
+    assert(r.first  == next(m.begin(), 0));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(6);
+    assert(r.first  == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 3));
+    r = m.equal_range(7);
+    assert(r.first  == next(m.begin(), 3));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(8);
+    assert(r.first  == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 6));
+    r = m.equal_range(9);
+    assert(r.first  == next(m.begin(), 6));
+    assert(r.second == next(m.begin(), 9));
+    r = m.equal_range(10);
+    assert(r.first  == next(m.begin(), 9));
+    assert(r.second == next(m.begin(), 9));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/erase_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/erase_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// iterator erase(const_iterator position);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multiset<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::multiset<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/multiset/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// iterator erase(const_iterator first, const_iterator last);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multiset<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::multiset<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/multiset/erase_key.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/erase_key.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/erase_key.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/erase_key.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,129 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 erase(const key_type& k);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multiset<int> M;
+        typedef int V;
+        typedef M::size_type I;
+        V ar[] =
+        {
+            3,
+            3,
+            3,
+            5,
+            5,
+            5,
+            7,
+            7,
+            7
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 9);
+        I i = m.erase(6);
+        assert(m.size() == 9);
+        assert(i == 0);
+        assert(*next(m.begin(), 0) == 3);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 5);
+        assert(*next(m.begin(), 5) == 5);
+        assert(*next(m.begin(), 6) == 7);
+        assert(*next(m.begin(), 7) == 7);
+        assert(*next(m.begin(), 8) == 7);
+
+        i = m.erase(5);
+        assert(m.size() == 6);
+        assert(i == 3);
+        assert(*next(m.begin(), 0) == 3);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 7);
+        assert(*next(m.begin(), 4) == 7);
+        assert(*next(m.begin(), 5) == 7);
+
+        i = m.erase(3);
+        assert(m.size() == 3);
+        assert(i == 3);
+        assert(*next(m.begin(), 0) == 7);
+        assert(*next(m.begin(), 1) == 7);
+        assert(*next(m.begin(), 2) == 7);
+
+        i = m.erase(7);
+        assert(m.size() == 0);
+        assert(i == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+        typedef int V;
+        typedef M::size_type I;
+        V ar[] =
+        {
+            3,
+            3,
+            3,
+            5,
+            5,
+            5,
+            7,
+            7,
+            7
+        };
+        M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+        assert(m.size() == 9);
+        I i = m.erase(6);
+        assert(m.size() == 9);
+        assert(i == 0);
+        assert(*next(m.begin(), 0) == 3);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 5);
+        assert(*next(m.begin(), 4) == 5);
+        assert(*next(m.begin(), 5) == 5);
+        assert(*next(m.begin(), 6) == 7);
+        assert(*next(m.begin(), 7) == 7);
+        assert(*next(m.begin(), 8) == 7);
+
+        i = m.erase(5);
+        assert(m.size() == 6);
+        assert(i == 3);
+        assert(*next(m.begin(), 0) == 3);
+        assert(*next(m.begin(), 1) == 3);
+        assert(*next(m.begin(), 2) == 3);
+        assert(*next(m.begin(), 3) == 7);
+        assert(*next(m.begin(), 4) == 7);
+        assert(*next(m.begin(), 5) == 7);
+
+        i = m.erase(3);
+        assert(m.size() == 3);
+        assert(i == 3);
+        assert(*next(m.begin(), 0) == 7);
+        assert(*next(m.begin(), 1) == 7);
+        assert(*next(m.begin(), 2) == 7);
+
+        i = m.erase(7);
+        assert(m.size() == 0);
+        assert(i == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/find.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/find.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/find.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+//       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::multiset<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::multiset<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::multiset<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::multiset<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/multiset/insert_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/insert_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/insert_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/insert_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 multiset
+
+// iterator insert(const value_type& v);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multiset<int> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(*r == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(*r == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// 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::multiset<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  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+    {
+    typedef std::multiset<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
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// iterator insert(const_iterator position, const value_type& v);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef std::multiset<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() == 4);
+        assert(*r == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multiset<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() == 4);
+        assert(*r == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/insert_iter_iter.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// 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::multiset<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() == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+        typedef std::multiset<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() == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// 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::multiset<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() == 4);
+        assert(*r == 3);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+    {
+        typedef std::multiset<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() == 4);
+        assert(*r == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/insert_rv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/insert_rv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/insert_rv.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/insert_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 multiset
+
+// iterator 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::multiset<MoveOnly> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(*r == 3);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+        typedef M::iterator R;
+        M m;
+        R r = m.insert(M::value_type(2));
+        assert(r == m.begin());
+        assert(m.size() == 1);
+        assert(*r == 2);
+
+        r = m.insert(M::value_type(1));
+        assert(r == m.begin());
+        assert(m.size() == 2);
+        assert(*r == 1);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 3);
+        assert(*r == 3);
+
+        r = m.insert(M::value_type(3));
+        assert(r == prev(m.end()));
+        assert(m.size() == 4);
+        assert(*r == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,215 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 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::multiset<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::multiset<int>::iterator i;
+        i = m.begin();
+        std::multiset<int>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= 8; ++j)
+            for (int k = 0; k < 3; ++k, ++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::multiset<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::multiset<int>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= 8; ++j)
+            for (int k = 0; k < 3; ++k, ++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::multiset<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::multiset<int, std::less<int>, min_allocator<int>>::iterator i;
+        i = m.begin();
+        std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+        assert(i == k);
+        for (int j = 1; j <= 8; ++j)
+            for (int k = 0; k < 3; ++k, ++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::multiset<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::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i;
+        i = m.begin();
+        for (int j = 1; j <= 8; ++j)
+            for (int k = 0; k < 3; ++k, ++i)
+                assert(*i == j);
+    }
+#endif
+#if _LIBCPP_STD_VER > 11
+    { // N3644 testing
+        typedef std::multiset<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/multiset/lower_bound.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/lower_bound.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/lower_bound.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/lower_bound.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,223 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 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::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.lower_bound(4);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(5);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(6);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(7);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(8);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_bound(9);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_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.lower_bound(4);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(5);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(6);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(7);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(8);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_bound(9);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_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.lower_bound(4);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(5);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(6);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(7);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(8);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_bound(9);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_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.lower_bound(4);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(5);
+            assert(r == next(m.begin(), 0));
+            r = m.lower_bound(6);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(7);
+            assert(r == next(m.begin(), 3));
+            r = m.lower_bound(8);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_bound(9);
+            assert(r == next(m.begin(), 6));
+            r = m.lower_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.lower_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.lower_bound(5);
+    assert(r == next(m.begin(), 0));
+    r = m.lower_bound(6);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(7);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(8);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_bound(9);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_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.lower_bound(4);
+    assert(r == next(m.begin(), 0));
+    r = m.lower_bound(5);
+    assert(r == next(m.begin(), 0));
+    r = m.lower_bound(6);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(7);
+    assert(r == next(m.begin(), 3));
+    r = m.lower_bound(8);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_bound(9);
+    assert(r == next(m.begin(), 6));
+    r = m.lower_bound(11);
+    assert(r == next(m.begin(), 9));
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/max_size.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/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 multiset
+
+// size_type max_size() const;
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    typedef std::multiset<int> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+    M m;
+    assert(m.max_size() != 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// multiset(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::multiset<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/multiset/multiset.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// multiset& operator=(initializer_list<value_type> il);
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+    {
+    typedef std::multiset<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  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+    {
+    typedef std::multiset<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
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// explicit multiset(const value_compare& comp);
+
+#include <set>
+#include <cassert>
+
+#include "../../../test_compare.h"
+
+int main()
+{
+    typedef test_compare<std::less<int> > C;
+    std::multiset<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/multiset/multiset.cons/compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// multiset(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::multiset<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/multiset/multiset.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// multiset(const multiset& 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::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::multiset<int, C, A> m = mo;
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 9);
+        assert(distance(mo.begin(), mo.end()) == 9);
+        assert(*next(mo.begin(), 0) == 1);
+        assert(*next(mo.begin(), 1) == 1);
+        assert(*next(mo.begin(), 2) == 1);
+        assert(*next(mo.begin(), 3) == 2);
+        assert(*next(mo.begin(), 4) == 2);
+        assert(*next(mo.begin(), 5) == 2);
+        assert(*next(mo.begin(), 6) == 3);
+        assert(*next(mo.begin(), 7) == 3);
+        assert(*next(mo.begin(), 8) == 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::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::multiset<int, C, A> m = mo;
+        assert(m.get_allocator() == A(-2));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 9);
+        assert(distance(mo.begin(), mo.end()) == 9);
+        assert(*next(mo.begin(), 0) == 1);
+        assert(*next(mo.begin(), 1) == 1);
+        assert(*next(mo.begin(), 2) == 1);
+        assert(*next(mo.begin(), 3) == 2);
+        assert(*next(mo.begin(), 4) == 2);
+        assert(*next(mo.begin(), 5) == 2);
+        assert(*next(mo.begin(), 6) == 3);
+        assert(*next(mo.begin(), 7) == 3);
+        assert(*next(mo.begin(), 8) == 3);
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// multiset(const multiset& 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::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+    std::multiset<int, C, A> m(mo, A(3));
+    assert(m.get_allocator() == A(3));
+    assert(m.key_comp() == C(5));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*next(m.begin(), 0) == 1);
+    assert(*next(m.begin(), 1) == 1);
+    assert(*next(m.begin(), 2) == 1);
+    assert(*next(m.begin(), 3) == 2);
+    assert(*next(m.begin(), 4) == 2);
+    assert(*next(m.begin(), 5) == 2);
+    assert(*next(m.begin(), 6) == 3);
+    assert(*next(m.begin(), 7) == 3);
+    assert(*next(m.begin(), 8) == 3);
+
+    assert(mo.get_allocator() == A(7));
+    assert(mo.key_comp() == C(5));
+    assert(mo.size() == 9);
+    assert(distance(mo.begin(), mo.end()) == 9);
+    assert(*next(mo.begin(), 0) == 1);
+    assert(*next(mo.begin(), 1) == 1);
+    assert(*next(mo.begin(), 2) == 1);
+    assert(*next(mo.begin(), 3) == 2);
+    assert(*next(mo.begin(), 4) == 2);
+    assert(*next(mo.begin(), 5) == 2);
+    assert(*next(mo.begin(), 6) == 3);
+    assert(*next(mo.begin(), 7) == 3);
+    assert(*next(mo.begin(), 8) == 3);
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,138 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// multiset& operator=(const multiset& 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::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
+        std::multiset<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() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+
+        assert(mo.get_allocator() == A(2));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 9);
+        assert(distance(mo.begin(), mo.end()) == 9);
+        assert(*next(mo.begin(), 0) == 1);
+        assert(*next(mo.begin(), 1) == 1);
+        assert(*next(mo.begin(), 2) == 1);
+        assert(*next(mo.begin(), 3) == 2);
+        assert(*next(mo.begin(), 4) == 2);
+        assert(*next(mo.begin(), 5) == 2);
+        assert(*next(mo.begin(), 6) == 3);
+        assert(*next(mo.begin(), 7) == 3);
+        assert(*next(mo.begin(), 8) == 3);
+    }
+    {
+        typedef int V;
+        const V ar[] =
+        {
+            1,
+            1,
+            1,
+            2,
+            2,
+            2,
+            3,
+            3,
+            3
+        };
+        std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        std::multiset<int> *p = &m;
+        m = *p;
+        assert(m.size() == 9);
+        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::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
+        std::multiset<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() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+
+        assert(mo.get_allocator() == A(2));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 9);
+        assert(distance(mo.begin(), mo.end()) == 9);
+        assert(*next(mo.begin(), 0) == 1);
+        assert(*next(mo.begin(), 1) == 1);
+        assert(*next(mo.begin(), 2) == 1);
+        assert(*next(mo.begin(), 3) == 2);
+        assert(*next(mo.begin(), 4) == 2);
+        assert(*next(mo.begin(), 5) == 2);
+        assert(*next(mo.begin(), 6) == 3);
+        assert(*next(mo.begin(), 7) == 3);
+        assert(*next(mo.begin(), 8) == 3);
+    }
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// multiset();
+
+#include <set>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+    {
+    std::multiset<int> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#if __cplusplus >= 201103L
+    {
+    std::multiset<int, std::less<int>, min_allocator<int>> m;
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+    {
+    std::multiset<int> m = {};
+    assert(m.empty());
+    assert(m.begin() == m.end());
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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>
+
+// multiset()
+//    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::multiset<MoveOnly> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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>
+
+// ~multiset() // 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::multiset<MoveOnly> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_destructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_destructible<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list.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 multiset
+
+// multiset(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::multiset<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  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+    {
+    typedef std::multiset<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));
+    }
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+    typedef C::value_type V;
+    min_allocator<int> a;
+    C m ({1, 2, 3, 4, 5, 6}, a);
+    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);
+    }
+#endif
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// multiset(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::multiset<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/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class multiset
+
+// multiset(initializer_list<value_type> il, const key_compare& comp, 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::multiset<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));
+#endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter.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 multiset
+
+// template <class InputIterator>
+//     multiset(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::multiset<V> m(input_iterator<const int*>(ar),
+                  input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*next(m.begin(), 0) == 1);
+    assert(*next(m.begin(), 1) == 1);
+    assert(*next(m.begin(), 2) == 1);
+    assert(*next(m.begin(), 3) == 2);
+    assert(*next(m.begin(), 4) == 2);
+    assert(*next(m.begin(), 5) == 2);
+    assert(*next(m.begin(), 6) == 3);
+    assert(*next(m.begin(), 7) == 3);
+    assert(*next(m.begin(), 8) == 3);
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef int V;
+    V ar[] =
+    {
+        1,
+        1,
+        1,
+        2,
+        2,
+        2,
+        3,
+        3,
+        3
+    };
+    std::multiset<V, std::less<V>, min_allocator<V>> m(input_iterator<const int*>(ar),
+                  input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*next(m.begin(), 0) == 1);
+    assert(*next(m.begin(), 1) == 1);
+    assert(*next(m.begin(), 2) == 1);
+    assert(*next(m.begin(), 3) == 2);
+    assert(*next(m.begin(), 4) == 2);
+    assert(*next(m.begin(), 5) == 2);
+    assert(*next(m.begin(), 6) == 3);
+    assert(*next(m.begin(), 7) == 3);
+    assert(*next(m.begin(), 8) == 3);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// template <class InputIterator>
+//     multiset(InputIterator first, InputIterator last,
+//         const value_compare& comp, 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::multiset<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() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*next(m.begin(), 0) == 1);
+    assert(*next(m.begin(), 1) == 1);
+    assert(*next(m.begin(), 2) == 1);
+    assert(*next(m.begin(), 3) == 2);
+    assert(*next(m.begin(), 4) == 2);
+    assert(*next(m.begin(), 5) == 2);
+    assert(*next(m.begin(), 6) == 3);
+    assert(*next(m.begin(), 7) == 3);
+    assert(*next(m.begin(), 8) == 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;
+    std::multiset<V, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+
+    assert(m.size() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*next(m.begin(), 0) == 1);
+    assert(*next(m.begin(), 1) == 1);
+    assert(*next(m.begin(), 2) == 1);
+    assert(*next(m.begin(), 3) == 2);
+    assert(*next(m.begin(), 4) == 2);
+    assert(*next(m.begin(), 5) == 2);
+    assert(*next(m.begin(), 6) == 3);
+    assert(*next(m.begin(), 7) == 3);
+    assert(*next(m.begin(), 8) == 3);
+    assert(m.get_allocator() == a);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.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>
+
+// class multiset
+
+// template <class InputIterator>
+//     multiset(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::multiset<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() == 9);
+    assert(distance(m.begin(), m.end()) == 9);
+    assert(*next(m.begin(), 0) == 1);
+    assert(*next(m.begin(), 1) == 1);
+    assert(*next(m.begin(), 2) == 1);
+    assert(*next(m.begin(), 3) == 2);
+    assert(*next(m.begin(), 4) == 2);
+    assert(*next(m.begin(), 5) == 2);
+    assert(*next(m.begin(), 6) == 3);
+    assert(*next(m.begin(), 7) == 3);
+    assert(*next(m.begin(), 8) == 3);
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,119 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// multiset(multiset&& 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::multiset<int, C, A> mo(C(5), A(7));
+        std::multiset<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::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
+        std::multiset<int, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A(7));
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+
+        assert(mo.get_allocator() == A(7));
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 0);
+        assert(distance(mo.begin(), mo.end()) == 0);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#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::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+        std::multiset<int, C, A> m = std::move(mo);
+        assert(m.get_allocator() == A());
+        assert(m.key_comp() == C(5));
+        assert(m.size() == 9);
+        assert(distance(m.begin(), m.end()) == 9);
+        assert(*next(m.begin(), 0) == 1);
+        assert(*next(m.begin(), 1) == 1);
+        assert(*next(m.begin(), 2) == 1);
+        assert(*next(m.begin(), 3) == 2);
+        assert(*next(m.begin(), 4) == 2);
+        assert(*next(m.begin(), 5) == 2);
+        assert(*next(m.begin(), 6) == 3);
+        assert(*next(m.begin(), 7) == 3);
+        assert(*next(m.begin(), 8) == 3);
+
+        assert(mo.get_allocator() == A());
+        assert(mo.key_comp() == C(5));
+        assert(mo.size() == 0);
+        assert(distance(mo.begin(), mo.end()) == 0);
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// multiset(multiset&& 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::multiset<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::multiset<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::multiset<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/multiset/multiset.cons/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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 multiset
+
+// multiset& operator=(multiset&& 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::multiset<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::multiset<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::multiset<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());
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+    {
+        typedef MoveOnly V;
+        typedef test_compare<std::less<MoveOnly> > C;
+        typedef min_allocator<V> A;
+        typedef std::multiset<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
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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>
+
+// multiset& operator=(multiset&& 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::multiset<MoveOnly> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_assignable<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp (added)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.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>
+
+// multiset(multiset&&)
+//        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::multiset<MoveOnly> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+        static_assert(std::is_nothrow_move_constructible<C>::value, "");
+    }
+    {
+        typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
+        static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+    }
+#endif
+}





More information about the cfe-commits mailing list