summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental
diff options
context:
space:
mode:
authorJonathan Coe <jbcoe@me.com>2016-06-19 19:34:13 +0000
committerJonathan Coe <jbcoe@me.com>2016-06-19 19:34:13 +0000
commit945cacc8424bd049bbe8973556f896ec4867cbfa (patch)
tree430703e1738c73825a6cc3032fa01bfb4e8199d1 /libcxx/test/std/experimental
parent92c9fef95fbcb704f307466261288ee25b3c0bd8 (diff)
downloadbcm5719-llvm-945cacc8424bd049bbe8973556f896ec4867cbfa.tar.gz
bcm5719-llvm-945cacc8424bd049bbe8973556f896ec4867cbfa.zip
Implement std::experimental::propagate_const from LFTS v2
Summary: An implementation of std::experimental::propagate_const from Library Fundamentals Technical Specification v2. No tests are provided for disallowed types like fancy pointers or function pointers as no code was written to handle these. Reviewers: EricWF, mclow.lists Differential Revision: http://reviews.llvm.org/D12486 llvm-svn: 273122
Diffstat (limited to 'libcxx/test/std/experimental')
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp24
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp34
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp25
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp34
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp32
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp33
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp33
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp28
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp32
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp26
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp28
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp31
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp24
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp28
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.non-explicit.ctor.pass.cpp28
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp28
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp34
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp24
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp34
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp34
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp35
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp29
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp26
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp29
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp29
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp28
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp32
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp44
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp36
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp38
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp38
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp38
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp38
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp36
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp64
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp54
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp50
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp55
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp50
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp62
-rw-r--r--libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp31
41 files changed, 1436 insertions, 0 deletions
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp
new file mode 100644
index 00000000000..33826383d12
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(const propagate_const<U>&)=delete;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() { static_assert(!std::is_assignable<P, const P &>::value, ""); }
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp
new file mode 100644
index 00000000000..6de6c63d610
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_element_type.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<CopyConstructibleFromX> PY;
+
+ X x1(1);
+ PY p(2);
+
+ assert(*p==2);
+
+ p = x1;
+
+ assert(*p==1);
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp
new file mode 100644
index 00000000000..ae6ef08d3cf
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_convertible_propagate_const.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator=(U&& u); // won't bind to propagate_const
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> PX;
+typedef propagate_const<CopyConstructibleFromX> PY;
+
+int main() { static_assert(!std::is_assignable<PY, const PX &>::value, ""); }
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp
new file mode 100644
index 00000000000..e4051325f1c
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/assign_element_type.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ X x1(1);
+ P p(2);
+
+ assert(*p==2);
+
+ p = x1;
+
+ assert(*p==1);
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp
new file mode 100644
index 00000000000..b112b078d82
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(propagate_const<U>&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1(1);
+ P p2(2);
+
+ p2=std::move(p1);
+
+ assert(*p2==1);
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp
new file mode 100644
index 00000000000..282f0aee615
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const& propagate_const::operator=(propagate_const<U>&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> PX;
+ typedef propagate_const<MoveConstructibleFromX> PY;
+
+ PX px2(2);
+ PY py1(1);
+
+ py1=std::move(px2);
+
+ assert(*py1==2);
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp
new file mode 100644
index 00000000000..743fc8eacbf
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.assignment/move_assign_convertible_propagate_const.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> PX;
+ typedef propagate_const<MoveConstructibleFromX> PY;
+
+ PX px2(2);
+ PY py1(1);
+
+ py1=std::move(px2);
+
+ assert(*py1==2);
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp
new file mode 100644
index 00000000000..10b0dd89628
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.explicit.ctor.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<ExplicitCopyConstructibleFromX> P;
+
+int main() {
+ static_assert(!std::is_convertible<P, X>::value, "");
+ static_assert(std::is_constructible<P, X>::value, "");
+}
+
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp
new file mode 100644
index 00000000000..8ba5261de5e
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_element_type.non-explicit.ctor.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<CopyConstructibleFromX> P;
+
+void f(const P& p)
+{
+ assert(*p==2);
+}
+
+int main() {
+ f(X(2));
+}
+
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp
new file mode 100644
index 00000000000..ca65f3c47ff
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.copy_ctor.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const& operator(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> PX;
+typedef propagate_const<CopyConstructibleFromX> PY;
+
+int main() { static_assert(!std::is_constructible<PX, PY>::value, ""); }
+
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp
new file mode 100644
index 00000000000..b021cbd5e5e
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.explicit.move_ctor.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> PX;
+typedef propagate_const<ExplicitMoveConstructibleFromX> PY;
+
+int main() {
+ static_assert(!std::is_convertible<PY, PX &&>::value, "");
+ static_assert(std::is_constructible<PY, PX &&>::value, "");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp
new file mode 100644
index 00000000000..ee104a5250e
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/convertible_propagate_const.move_ctor.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> constexpr propagate_const(propagate_const<_Up>&& pu);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<MoveConstructibleFromX> PY;
+typedef propagate_const<X> PX;
+
+int main() {
+ PX px(1);
+ PY py(std::move(px));
+
+ assert(*py==1);
+}
+
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp
new file mode 100644
index 00000000000..daefdf320e3
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/copy_ctor.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const(const propagate_const&)=delete;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() { static_assert(!std::is_constructible<P, const P &>::value, ""); }
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp
new file mode 100644
index 00000000000..6a7289b2f1a
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.explicit.ctor.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<ExplicitX> P;
+
+int main() {
+ static_assert(!std::is_convertible<P, int>::value, "");
+ static_assert(std::is_constructible<P, int>::value, "");
+}
+
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.non-explicit.ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.non-explicit.ctor.pass.cpp
new file mode 100644
index 00000000000..9c6ed89f675
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/element_type.non-explicit.ctor.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class U> propagate_const(U&&);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+void f(const P&)
+{
+}
+
+int main() { f(2); }
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
new file mode 100644
index 00000000000..a5adf2d1f7f
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const(propagate_const&&)=default;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1(2);
+ P p2(std::move(p1));
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp
new file mode 100644
index 00000000000..5e9e0434fed
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/dereference.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// element_type& propagate_const::operator*();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+constexpr P f()
+{
+ P p(1);
+ *p = 2;
+ return p;
+}
+
+int main() {
+ constexpr P p = f();
+ static_assert(*p==2,"");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp
new file mode 100644
index 00000000000..808eda0e3cc
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/explicit_operator_element_type_ptr.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator element_type*();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() { static_assert(!std::is_convertible<P, int *>::value, ""); }
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp
new file mode 100644
index 00000000000..298389b7b59
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/get.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// element_type* propagate_const::get();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+constexpr P f()
+{
+ P p(1);
+ *p.get() = 2;
+ return p;
+}
+
+int main() {
+ constexpr P p = f();
+ static_assert(*(p.get())==2,"");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp
new file mode 100644
index 00000000000..810e86eea17
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/op_arrow.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// element_type* propagate_const::operator->();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+constexpr P f()
+{
+ P p(1);
+ *(p.operator->()) = 2;
+ return p;
+}
+
+int main() {
+ constexpr P p = f();
+ static_assert(*(p.operator->())==2,"");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp
new file mode 100644
index 00000000000..6bdf76c92e9
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.non-const_observers/operator_element_type_ptr.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator element_type*();
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<XWithImplicitIntStarConversion> P;
+
+ P p(1);
+
+ int* ptr_1 = p;
+
+ assert(*ptr_1==1);
+
+ *ptr_1 = 2;
+
+ assert(*ptr_1==2);
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp
new file mode 100644
index 00000000000..29233544964
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/dereference.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// const element_type& propagate_const::operator*() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ constexpr P p(1);
+
+ static_assert(*p==1,"");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp
new file mode 100644
index 00000000000..b9b6b3f90f2
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/explicit_operator_element_type_ptr.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator const element_type*() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <type_traits>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<X> P;
+
+int main() {
+ static_assert(!std::is_convertible<const P, const int *>::value, "");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp
new file mode 100644
index 00000000000..8029ff47475
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/get.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// const element_type* propagate_const::get() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ constexpr P p(1);
+
+ static_assert(*(p.get())==1, "");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp
new file mode 100644
index 00000000000..4ceea8a1d78
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/op_arrow.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// const element_type* propagate_const::operator->() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ constexpr P p(1);
+
+ static_assert(*(p.operator->())==1,"");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp
new file mode 100644
index 00000000000..1ac6d254a34
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.observers/operator_element_type_ptr.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// propagate_const::operator const element_type*() const;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+typedef propagate_const<XWithImplicitConstIntStarConversion> P;
+
+constexpr P p(1);
+
+constexpr const int *ptr_1 = p;
+
+int main() { assert(*ptr_1 == 1); }
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp
new file mode 100644
index 00000000000..c5c832bbe0c
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.class/swap.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr void propagate_const::swap(propagate_const<T>& x);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+bool swap_called = false;
+void swap(X &, X &) { swap_called = true; }
+
+int main() {
+ typedef propagate_const<X> P;
+ P p1(1);
+ P p2(2);
+ p1.swap(p2);
+ assert(swap_called);
+}
+
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
new file mode 100644
index 00000000000..8cf670a2540
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+namespace std {
+template <> struct hash<X>
+{
+ typedef X first_argument_type;
+
+ size_t operator()(const first_argument_type& x1) const
+ {
+ return 99;
+ }
+
+};
+} // namespace std
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p(1);
+
+ auto h = std::hash<P>();
+
+ assert(h(p)==99);
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp
new file mode 100644
index 00000000000..d54222a97a1
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct equal_to<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator==(const X &x1, const X &x2) { return x1.i_ == x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::equal_to<P>();
+
+ assert(c(p1_1,p2_1));
+ assert(!c(p1_1,p3_2));
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp
new file mode 100644
index 00000000000..fb8e1282f21
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct greater<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>(const X &x1, const X &x2) { return x1.i_ > x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::greater<P>();
+
+ assert(!c(p1_1,p2_1));
+ assert(!c(p2_1,p1_1));
+ assert(!c(p1_1,p3_2));
+ assert(c(p3_2,p1_1));
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp
new file mode 100644
index 00000000000..29a1868d647
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/greater_equal.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct greater_equal<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>=(const X &x1, const X &x2) { return x1.i_ >= x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::greater_equal<P>();
+
+ assert(c(p1_1,p2_1));
+ assert(c(p2_1,p1_1));
+ assert(!c(p1_1,p3_2));
+ assert(c(p3_2,p1_1));
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp
new file mode 100644
index 00000000000..074a3914a51
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct less<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<(const X &x1, const X &x2) { return x1.i_ < x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::less<P>();
+
+ assert(!c(p1_1,p2_1));
+ assert(!c(p2_1,p1_1));
+ assert(c(p1_1,p3_2));
+ assert(!c(p3_2,p1_1));
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp
new file mode 100644
index 00000000000..a2082ec5cb3
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/less_equal.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct less_equal<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<=(const X &x1, const X &x2) { return x1.i_ <= x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::less_equal<P>();
+
+ assert(c(p1_1,p2_1));
+ assert(c(p2_1,p1_1));
+ assert(c(p1_1,p3_2));
+ assert(!c(p3_2,p1_1));
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp
new file mode 100644
index 00000000000..20756d984e9
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/not_equal_to.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> struct not_equal_to<experimental::fundamentals_v2::propagate_const<T>>;
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator!=(const X &x1, const X &x2) { return x1.i_ != x2.i_; }
+
+int main() {
+
+ typedef propagate_const<X> P;
+
+ P p1_1(1);
+ P p2_1(1);
+ P p3_2(2);
+
+ auto c = std::not_equal_to<P>();
+
+ assert(!c(p1_1,p2_1));
+ assert(c(p1_1,p3_2));
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp
new file mode 100644
index 00000000000..a4a28b48a54
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/equal.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator==(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator==(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator==(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+using std::nullptr_t;
+
+constexpr bool operator==(const X &lhs, const X &rhs) {
+ return lhs.i_ == rhs.i_;
+}
+
+constexpr bool operator==(const X &, const nullptr_t &) {
+ return false;
+}
+
+constexpr bool operator==(const nullptr_t &, const X &) {
+ return false;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(x1_1 == x1_1, "");
+ static_assert(x1_1 == x2_1, "");
+ static_assert(!(x1_1 == x3_2), "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(p1_1 == p1_1, "");
+ static_assert(p1_1 == p2_1, "");
+ static_assert(!(p1_1 == p3_2), "");
+
+ static_assert(x1_1 == p1_1, "");
+ static_assert(!(x1_1 == p3_2), "");
+
+ static_assert(p1_1 == x1_1, "");
+ static_assert(!(p1_1 == x3_2), "");
+
+ static_assert(!(p1_1==nullptr),"");
+ static_assert(!(nullptr==p1_1),"");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp
new file mode 100644
index 00000000000..4b5b42467c0
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_equal.pass.cpp
@@ -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.
+//
+//>==---------------------------------------------------------------------->==//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator>=(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>=(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>=(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>=(const X &lhs, const X &rhs) {
+ return lhs.i_ >= rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(x1_1 >= x2_1, "");
+ static_assert(!(x1_1 >= x3_2), "");
+ static_assert(x3_2 >= x1_1, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(p1_1 >= p2_1, "");
+ static_assert(!(p1_1 >= p3_2), "");
+ static_assert(p3_2 >= p1_1, "");
+
+ static_assert(p1_1 >= x2_1, "");
+ static_assert(!(p1_1 >= x3_2), "");
+ static_assert(p3_2 >= x1_1, "");
+
+ static_assert(x1_1 >= p2_1, "");
+ static_assert(!(x1_1 >= p3_2), "");
+ static_assert(x3_2 >= p1_1, "");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp
new file mode 100644
index 00000000000..3865b937072
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator>(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator>(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator>(const X &lhs, const X &rhs) {
+ return lhs.i_ > rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(!(x1_1 > x2_1), "");
+ static_assert(x3_2 > x1_1, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(!(p1_1 > p2_1), "");
+ static_assert(p3_2 > p1_1, "");
+
+ static_assert(!(p1_1 > x2_1), "");
+ static_assert(p3_2 > x1_1, "");
+
+ static_assert(!(x1_1 > p2_1), "");
+ static_assert(x3_2 > p1_1, "");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp
new file mode 100644
index 00000000000..3ac12c27f8b
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_equal.pass.cpp
@@ -0,0 +1,55 @@
+//<==----------------------------------------------------------------------<==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//<==----------------------------------------------------------------------<==//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator<=(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<=(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<=(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<=(const X &lhs, const X &rhs) {
+ return lhs.i_ <= rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(x1_1 <= x2_1, "");
+ static_assert(x1_1 <= x3_2, "");
+ static_assert(!(x3_2 <= x1_1), "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(p1_1 <= p2_1, "");
+ static_assert(p1_1 <= p3_2, "");
+ static_assert(!(p3_2 <= p1_1), "");
+
+ static_assert(p1_1 <= x2_1, "");
+ static_assert(p1_1 <= x3_2, "");
+ static_assert(!(p3_2 <= x1_1), "");
+
+ static_assert(x1_1 <= p2_1, "");
+ static_assert(x1_1 <= p3_2, "");
+ static_assert(!(x3_2 <= p1_1), "");
+
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp
new file mode 100644
index 00000000000..42b2730c58c
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/less_than.pass.cpp
@@ -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: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator<(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator<(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+constexpr bool operator<(const X &lhs, const X &rhs) {
+ return lhs.i_ < rhs.i_;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(!(x1_1 < x2_1), "");
+ static_assert(x1_1 < x3_2, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(!(p1_1 < p2_1), "");
+ static_assert(p1_1 < p3_2, "");
+
+ static_assert(!(x1_1 < p1_1), "");
+ static_assert(x1_1 < p3_2, "");
+
+ static_assert(!(p1_1 < x1_1), "");
+ static_assert(p1_1 < x3_2, "");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp
new file mode 100644
index 00000000000..1104abdecb6
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/not_equal.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr bool operator!=(const propagate_const<T>& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator!=(const T& x, const propagate_const<T>& y);
+// template <class T> constexpr bool operator!=(const propagate_const<T>& x, const T& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+using std::nullptr_t;
+
+constexpr bool operator!=(const X &lhs, const X &rhs) {
+ return lhs.i_ != rhs.i_;
+}
+
+constexpr bool operator!=(const X &, const nullptr_t &) {
+ return true;
+}
+
+constexpr bool operator!=(const nullptr_t &, const X &) {
+ return true;
+}
+
+int main() {
+ constexpr X x1_1(1);
+ constexpr X x2_1(1);
+ constexpr X x3_2(2);
+
+ static_assert(!(x1_1 != x2_1), "");
+ static_assert(x1_1 != x3_2, "");
+
+ typedef propagate_const<X> P;
+
+ constexpr P p1_1(1);
+ constexpr P p2_1(1);
+ constexpr P p3_2(2);
+
+ static_assert(!(p1_1 != p2_1), "");
+ static_assert(p1_1 != p3_2, "");
+
+ static_assert(!(x1_1 != p1_1), "");
+ static_assert(x1_1 != p3_2, "");
+
+ static_assert(!(p1_1 != x1_1), "");
+ static_assert(p1_1 != x3_2, "");
+
+ static_assert(p1_1!=nullptr,"");
+ static_assert(nullptr!=p1_1,"");
+}
diff --git a/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp
new file mode 100644
index 00000000000..6c3b6094896
--- /dev/null
+++ b/libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/swap.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <propagate_const>
+
+// template <class T> constexpr void swap(propagate_const<T>& x, propagate_const<T>& y);
+
+#include <experimental/propagate_const>
+#include "propagate_const_helpers.h"
+#include <cassert>
+
+using std::experimental::propagate_const;
+
+bool swap_called = false;
+void swap(X &, X &) { swap_called = true; }
+
+int main() {
+ typedef propagate_const<X> P;
+ P p1(1);
+ P p2(2);
+ swap(p1, p2);
+ assert(swap_called);
+}
OpenPOWER on IntegriCloud