summaryrefslogtreecommitdiffstats
path: root/libcxx/test/experimental/optional/optional.syn
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/experimental/optional/optional.syn')
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp28
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp26
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp28
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_in_place_t.fail.cpp28
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp23
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp26
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp28
-rw-r--r--libcxx/test/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp26
8 files changed, 213 insertions, 0 deletions
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp b/libcxx/test/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp
new file mode 100644
index 00000000000..60836ae2396
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_const_in_place_t.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// A program that necessitates the instantiation of template optional for
+// (possibly cv-qualified) in_place_t is ill-formed.
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+ using std::experimental::in_place_t;
+ using std::experimental::in_place;
+
+ optional<const in_place_t> opt;
+#else
+#error
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp b/libcxx/test/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp
new file mode 100644
index 00000000000..9a4ba1a027a
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// A program that necessitates the instantiation of template optional for a
+// reference type is ill-formed.
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+
+ optional<const int&> opt;
+#else
+#error
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp b/libcxx/test/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp
new file mode 100644
index 00000000000..f6220bda69c
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_const_nullopt_t.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// A program that necessitates the instantiation of template optional for
+// (possibly cv-qualified) null_opt_t is ill-formed.
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+ using std::experimental::nullopt_t;
+ using std::experimental::nullopt;
+
+ optional<const nullopt_t> opt;
+#else
+#error
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_in_place_t.fail.cpp b/libcxx/test/experimental/optional/optional.syn/optional_in_place_t.fail.cpp
new file mode 100644
index 00000000000..12f291fcd22
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_in_place_t.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// A program that necessitates the instantiation of template optional for
+// (possibly cv-qualified) in_place_t is ill-formed.
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+ using std::experimental::in_place_t;
+ using std::experimental::in_place;
+
+ optional<in_place_t> opt;
+#else
+#error
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp b/libcxx/test/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
new file mode 100644
index 00000000000..7e6697ff6e5
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// #include <initializer_list>
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+
+ std::initializer_list<int> list;
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp b/libcxx/test/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp
new file mode 100644
index 00000000000..850df342aef
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_lvalue_ref.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// A program that necessitates the instantiation of template optional for a
+// reference type is ill-formed.
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+
+ optional<int&> opt;
+#else
+#error
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp b/libcxx/test/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp
new file mode 100644
index 00000000000..20955ace834
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_nullopt_t.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// A program that necessitates the instantiation of template optional for
+// (possibly cv-qualified) null_opt_t is ill-formed.
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+ using std::experimental::nullopt_t;
+ using std::experimental::nullopt;
+
+ optional<nullopt_t> opt;
+#else
+#error
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/libcxx/test/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp b/libcxx/test/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp
new file mode 100644
index 00000000000..d773e993df2
--- /dev/null
+++ b/libcxx/test/experimental/optional/optional.syn/optional_rvalue_ref.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+// A program that necessitates the instantiation of template optional for a
+// reference type is ill-formed.
+
+#include <experimental/optional>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ using std::experimental::optional;
+
+ optional<int&&> opt;
+#else
+#error
+#endif // _LIBCPP_STD_VER > 11
+}
OpenPOWER on IntegriCloud