aboutsummaryrefslogtreecommitdiff
path: root/test/std/experimental/optional/optional.object/types.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/experimental/optional/optional.object/types.pass.cpp')
-rw-r--r--test/std/experimental/optional/optional.object/types.pass.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/std/experimental/optional/optional.object/types.pass.cpp b/test/std/experimental/optional/optional.object/types.pass.cpp
new file mode 100644
index 000000000000..8b9ad2e19570
--- /dev/null
+++ b/test/std/experimental/optional/optional.object/types.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// template <class T>
+// class optional
+// {
+// public:
+// typedef T value_type;
+// ...
+
+#include <experimental/optional>
+#include <type_traits>
+
+#if _LIBCPP_STD_VER > 11
+
+using std::experimental::optional;
+
+template <class Opt, class T>
+void
+test()
+{
+ static_assert(std::is_same<typename Opt::value_type, T>::value, "");
+}
+
+#endif // _LIBCPP_STD_VER > 11
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ test<optional<int>, int>();
+ test<optional<const int>, const int>();
+ test<optional<double>, double>();
+ test<optional<const double>, const double>();
+#endif // _LIBCPP_STD_VER > 11
+}