瀏覽代碼

Remove <experimental/optional>; use <optional> instead. See https://libcxx.llvm.org/TS_deprecation.html

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323971 91177308-0d34-0410-b5e6-96231b3b80d8
Marshall Clow 7 年之前
父節點
當前提交
95db3d2871
共有 72 個文件被更改,包括 1 次插入5262 次删除
  1. 1 912
      include/experimental/optional
  2. 0 4
      include/module.modulemap
  3. 0 6
      src/optional.cpp
  4. 0 1
      test/libcxx/double_include.sh.cpp
  5. 0 20
      test/libcxx/experimental/optional/version.pass.cpp
  6. 0 2
      test/libcxx/min_max_macros.sh.cpp
  7. 0 29
      test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp
  8. 0 31
      test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp
  9. 0 53
      test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp
  10. 0 55
      test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp
  11. 0 55
      test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp
  12. 0 55
      test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp
  13. 0 55
      test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp
  14. 0 53
      test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp
  15. 0 12
      test/std/experimental/optional/optional.defs/tested_elsewhere.pass.cpp
  16. 0 12
      test/std/experimental/optional/optional.general/nothing_to_do.pass.cpp
  17. 0 46
      test/std/experimental/optional/optional.hash/hash.pass.cpp
  18. 0 36
      test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp
  19. 0 39
      test/std/experimental/optional/optional.nullops/equal.pass.cpp
  20. 0 39
      test/std/experimental/optional/optional.nullops/greater.pass.cpp
  21. 0 39
      test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp
  22. 0 43
      test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
  23. 0 39
      test/std/experimental/optional/optional.nullops/less_than.pass.cpp
  24. 0 39
      test/std/experimental/optional/optional.nullops/not_equal.pass.cpp
  25. 0 38
      test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp
  26. 0 80
      test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
  27. 0 101
      test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
  28. 0 153
      test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
  29. 0 126
      test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
  30. 0 114
      test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
  31. 0 62
      test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
  32. 0 116
      test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
  33. 0 139
      test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
  34. 0 62
      test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp
  35. 0 144
      test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
  36. 0 118
      test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
  37. 0 149
      test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
  38. 0 63
      test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp
  39. 0 110
      test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
  40. 0 54
      test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp
  41. 0 31
      test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp
  42. 0 44
      test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp
  43. 0 52
      test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
  44. 0 43
      test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
  45. 0 65
      test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
  46. 0 59
      test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
  47. 0 33
      test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp
  48. 0 64
      test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
  49. 0 66
      test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp
  50. 0 77
      test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
  51. 0 313
      test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
  52. 0 22
      test/std/experimental/optional/optional.object/optional_const_void.fail.cpp
  53. 0 28
      test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp
  54. 0 27
      test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp
  55. 0 22
      test/std/experimental/optional/optional.object/optional_void.fail.cpp
  56. 0 38
      test/std/experimental/optional/optional.object/types.pass.cpp
  57. 0 74
      test/std/experimental/optional/optional.relops/equal.pass.cpp
  58. 0 70
      test/std/experimental/optional/optional.relops/greater_equal.pass.cpp
  59. 0 70
      test/std/experimental/optional/optional.relops/greater_than.pass.cpp
  60. 0 70
      test/std/experimental/optional/optional.relops/less_equal.pass.cpp
  61. 0 70
      test/std/experimental/optional/optional.relops/less_than.pass.cpp
  62. 0 74
      test/std/experimental/optional/optional.relops/not_equal.pass.cpp
  63. 0 51
      test/std/experimental/optional/optional.specalg/make_optional.pass.cpp
  64. 0 303
      test/std/experimental/optional/optional.specalg/swap.pass.cpp
  65. 0 25
      test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp
  66. 0 23
      test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp
  67. 0 25
      test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp
  68. 0 25
      test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp
  69. 0 23
      test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
  70. 0 23
      test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp
  71. 0 25
      test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp
  72. 0 23
      test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp

+ 1 - 912
include/experimental/optional

@@ -8,915 +8,4 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL
-#define _LIBCPP_EXPERIMENTAL_OPTIONAL
-
-/*
-    optional synopsis
-
-// C++1y
-
-namespace std { namespace experimental { inline namespace fundamentals_v1 {
-
-    // 5.3, optional for object types
-    template <class T> class optional;
-
-    // 5.4, In-place construction
-    struct in_place_t{};
-    constexpr in_place_t in_place{};
-
-    // 5.5, No-value state indicator
-    struct nullopt_t{see below};
-    constexpr nullopt_t nullopt(unspecified);
-
-    // 5.6, Class bad_optional_access
-    class bad_optional_access;
-
-    // 5.7, Relational operators
-    template <class T>
-      constexpr bool operator==(const optional<T>&, const optional<T>&);
-    template <class T>
-      constexpr bool operator!=(const optional<T>&, const optional<T>&);
-    template <class T>
-      constexpr bool operator<(const optional<T>&, const optional<T>&);
-    template <class T>
-      constexpr bool operator>(const optional<T>&, const optional<T>&);
-    template <class T>
-      constexpr bool operator<=(const optional<T>&, const optional<T>&);
-    template <class T>
-      constexpr bool operator>=(const optional<T>&, const optional<T>&);
-
-    // 5.8, Comparison with nullopt
-    template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
-    template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
-    template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
-    template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
-    template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
-    template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
-    template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
-    template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
-    template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
-    template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
-    template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
-    template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
-
-    // 5.9, Comparison with T
-    template <class T> constexpr bool operator==(const optional<T>&, const T&);
-    template <class T> constexpr bool operator==(const T&, const optional<T>&);
-    template <class T> constexpr bool operator!=(const optional<T>&, const T&);
-    template <class T> constexpr bool operator!=(const T&, const optional<T>&);
-    template <class T> constexpr bool operator<(const optional<T>&, const T&);
-    template <class T> constexpr bool operator<(const T&, const optional<T>&);
-    template <class T> constexpr bool operator<=(const optional<T>&, const T&);
-    template <class T> constexpr bool operator<=(const T&, const optional<T>&);
-    template <class T> constexpr bool operator>(const optional<T>&, const T&);
-    template <class T> constexpr bool operator>(const T&, const optional<T>&);
-    template <class T> constexpr bool operator>=(const optional<T>&, const T&);
-    template <class T> constexpr bool operator>=(const T&, const optional<T>&);
-
-    // 5.10, Specialized algorithms
-    template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
-    template <class T> constexpr optional<see below> make_optional(T&&);
-
-	template <class T>
-	class optional
-	{
-	public:
-	  typedef T value_type;
-
-	  // 5.3.1, Constructors
-	  constexpr optional() noexcept;
-	  constexpr optional(nullopt_t) noexcept;
-	  optional(const optional&);
-	  optional(optional&&) noexcept(see below);
-	  constexpr optional(const T&);
-	  constexpr optional(T&&);
-	  template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
-	  template <class U, class... Args>
-		constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
-
-	  // 5.3.2, Destructor
-	  ~optional();
-
-	  // 5.3.3, Assignment
-	  optional& operator=(nullopt_t) noexcept;
-	  optional& operator=(const optional&);
-	  optional& operator=(optional&&) noexcept(see below);
-	  template <class U> optional& operator=(U&&);
-	  template <class... Args> void emplace(Args&&...);
-	  template <class U, class... Args>
-		void emplace(initializer_list<U>, Args&&...);
-
-	  // 5.3.4, Swap
-	  void swap(optional&) noexcept(see below);
-
-	  // 5.3.5, Observers
-	  constexpr T const* operator ->() const;
-	  constexpr T* operator ->();
-	  constexpr T const& operator *() const &;
-	  constexpr T& operator *() &;
-	  constexpr T&& operator *() &&;
-	  constexpr const T&& operator *() const &&;
-	  constexpr explicit operator bool() const noexcept;
-	  constexpr T const& value() const &;
-	  constexpr T& value() &;
-	  constexpr T&& value() &&;
-	  constexpr const T&& value() const &&;
-	  template <class U> constexpr T value_or(U&&) const &;
-	  template <class U> constexpr T value_or(U&&) &&;
-
-	private:
-	  T*   val;  // exposition only
-	};
-
-  } // namespace fundamentals_v1
-  } // namespace experimental
-
-  // 5.11, Hash support
-  template <class T> struct hash;
-  template <class T> struct hash<experimental::optional<T>>;
-
-} // namespace std
-
-*/
-
-#include <experimental/__config>
-#include <functional>
-#include <stdexcept>
-#if _LIBCPP_STD_VER > 11
-#include <initializer_list>
-#include <type_traits>
-#include <new>
-#include <__functional_base>
-#include <__debug>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
-    : public std::logic_error
-{
-public:
-	bad_optional_access() : std::logic_error("Bad optional Access") {}
-
-//	Get the key function ~bad_optional_access() into the dylib
-    virtual ~bad_optional_access() _NOEXCEPT;
-};
-
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-
-#if _LIBCPP_STD_VER > 11
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS
-
-struct in_place_t {};
-constexpr in_place_t in_place{};
-
-struct nullopt_t
-{
-    explicit constexpr nullopt_t(int) noexcept {}
-};
-
-constexpr nullopt_t nullopt{0};
-
-template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
-class __optional_storage
-{
-protected:
-    typedef _Tp value_type;
-    union
-    {
-        char __null_state_;
-        value_type __val_;
-    };
-    bool __engaged_ = false;
-
-    _LIBCPP_INLINE_VISIBILITY
-    ~__optional_storage()
-    {
-        if (__engaged_)
-            __val_.~value_type();
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr __optional_storage() noexcept
-        :  __null_state_('\0') {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    __optional_storage(const __optional_storage& __x)
-        :  __engaged_(__x.__engaged_)
-        {
-            if (__engaged_)
-                ::new((void*)_VSTD::addressof(__val_)) value_type(__x.__val_);
-        }
-
-    _LIBCPP_INLINE_VISIBILITY
-    __optional_storage(__optional_storage&& __x)
-                      noexcept(is_nothrow_move_constructible<value_type>::value)
-        :  __engaged_(__x.__engaged_)
-        {
-            if (__engaged_)
-                ::new((void*)_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
-        }
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr __optional_storage(const value_type& __v)
-        :  __val_(__v),
-           __engaged_(true) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr __optional_storage(value_type&& __v)
-        :  __val_(_VSTD::move(__v)),
-           __engaged_(true) {}
-
-    template <class... _Args>
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr
-    explicit __optional_storage(in_place_t, _Args&&... __args)
-       :  __val_(_VSTD::forward<_Args>(__args)...),
-           __engaged_(true) {}
-};
-
-template <class _Tp>
-class __optional_storage<_Tp, true>
-{
-protected:
-    typedef _Tp value_type;
-    union
-    {
-        char __null_state_;
-        value_type __val_;
-    };
-    bool __engaged_ = false;
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr __optional_storage() noexcept
-        :  __null_state_('\0') {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    __optional_storage(const __optional_storage& __x)
-        :  __engaged_(__x.__engaged_)
-        {
-            if (__engaged_)
-                ::new((void*)_VSTD::addressof(__val_)) value_type(__x.__val_);
-        }
-
-    _LIBCPP_INLINE_VISIBILITY
-    __optional_storage(__optional_storage&& __x)
-                      noexcept(is_nothrow_move_constructible<value_type>::value)
-        :  __engaged_(__x.__engaged_)
-        {
-            if (__engaged_)
-                ::new((void*)_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
-        }
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr __optional_storage(const value_type& __v)
-        :  __val_(__v),
-           __engaged_(true) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr __optional_storage(value_type&& __v)
-        :  __val_(_VSTD::move(__v)),
-           __engaged_(true) {}
-
-    template <class... _Args>
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr
-    explicit __optional_storage(in_place_t, _Args&&... __args)
-       :  __val_(_VSTD::forward<_Args>(__args)...),
-           __engaged_(true) {}
-};
-
-template <class _Tp>
-class optional
-    : private __optional_storage<_Tp>
-{
-    typedef __optional_storage<_Tp> __base;
-public:
-    typedef _Tp value_type;
-
-    static_assert(!is_reference<value_type>::value,
-              "Instantiation of optional with a reference type is ill-formed.");
-    static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
-              "Instantiation of optional with a in_place_t type is ill-formed.");
-    static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
-              "Instantiation of optional with a nullopt_t type is ill-formed.");
-    static_assert(is_object<value_type>::value,
-        "Instantiation of optional with a non-object type is undefined behavior.");
-    static_assert(is_nothrow_destructible<value_type>::value,
-        "Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
-
-    _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
-    _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
-    _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
-    _LIBCPP_INLINE_VISIBILITY ~optional() = default;
-    _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
-    _LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
-        : __base(__v) {}
-    _LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
-        : __base(_VSTD::move(__v)) {}
-
-    template <class... _Args,
-              class = typename enable_if
-                      <
-                           is_constructible<value_type, _Args...>::value
-                      >::type
-             >
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr
-    explicit optional(in_place_t, _Args&&... __args)
-        : __base(in_place, _VSTD::forward<_Args>(__args)...) {}
-
-    template <class _Up, class... _Args,
-              class = typename enable_if
-                      <
-                           is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
-                      >::type
-             >
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr
-    explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
-        : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    optional& operator=(nullopt_t) noexcept
-    {
-        if (this->__engaged_)
-        {
-            this->__val_.~value_type();
-            this->__engaged_ = false;
-        }
-        return *this;
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    optional&
-    operator=(const optional& __opt)
-    {
-        if (this->__engaged_ == __opt.__engaged_)
-        {
-            if (this->__engaged_)
-                this->__val_ = __opt.__val_;
-        }
-        else
-        {
-            if (this->__engaged_)
-                this->__val_.~value_type();
-            else
-                ::new((void*)_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
-            this->__engaged_ = __opt.__engaged_;
-        }
-        return *this;
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    optional&
-    operator=(optional&& __opt)
-        noexcept(is_nothrow_move_assignable<value_type>::value &&
-                 is_nothrow_move_constructible<value_type>::value)
-    {
-        if (this->__engaged_ == __opt.__engaged_)
-        {
-            if (this->__engaged_)
-                this->__val_ = _VSTD::move(__opt.__val_);
-        }
-        else
-        {
-            if (this->__engaged_)
-                this->__val_.~value_type();
-            else
-                ::new((void*)_VSTD::addressof(this->__val_))
-                    value_type(_VSTD::move(__opt.__val_));
-            this->__engaged_ = __opt.__engaged_;
-        }
-        return *this;
-    }
-
-    template <class _Up,
-              class = typename enable_if
-                      <
-                          is_same<typename remove_reference<_Up>::type, value_type>::value &&
-                          is_constructible<value_type, _Up>::value &&
-                          is_assignable<value_type&, _Up>::value
-                      >::type
-             >
-    _LIBCPP_INLINE_VISIBILITY
-    optional&
-    operator=(_Up&& __v)
-    {
-        if (this->__engaged_)
-            this->__val_ = _VSTD::forward<_Up>(__v);
-        else
-        {
-            ::new((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
-            this->__engaged_ = true;
-        }
-        return *this;
-    }
-
-    template <class... _Args,
-              class = typename enable_if
-                      <
-                          is_constructible<value_type, _Args...>::value
-                      >::type
-             >
-    _LIBCPP_INLINE_VISIBILITY
-    void
-    emplace(_Args&&... __args)
-    {
-        *this = nullopt;
-        ::new((void*)_VSTD::addressof(this->__val_))
-            value_type(_VSTD::forward<_Args>(__args)...);
-        this->__engaged_ = true;
-    }
-
-    template <class _Up, class... _Args,
-              class = typename enable_if
-                      <
-                          is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
-                      >::type
-             >
-    _LIBCPP_INLINE_VISIBILITY
-    void
-    emplace(initializer_list<_Up> __il, _Args&&... __args)
-    {
-        *this = nullopt;
-        ::new((void*)_VSTD::addressof(this->__val_))
-            value_type(__il, _VSTD::forward<_Args>(__args)...);
-        this->__engaged_ = true;
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    void
-    swap(optional& __opt)
-        noexcept(is_nothrow_move_constructible<value_type>::value &&
-                 __is_nothrow_swappable<value_type>::value)
-    {
-        using _VSTD::swap;
-        if (this->__engaged_ == __opt.__engaged_)
-        {
-            if (this->__engaged_)
-                swap(this->__val_, __opt.__val_);
-        }
-        else
-        {
-            if (this->__engaged_)
-            {
-                ::new((void*)_VSTD::addressof(__opt.__val_))
-                    value_type(_VSTD::move(this->__val_));
-                this->__val_.~value_type();
-            }
-            else
-            {
-                ::new((void*)_VSTD::addressof(this->__val_))
-                    value_type(_VSTD::move(__opt.__val_));
-                __opt.__val_.~value_type();
-            }
-            swap(this->__engaged_, __opt.__engaged_);
-        }
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr
-    value_type const*
-    operator->() const
-    {
-        _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
-#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
-        return __builtin_addressof(this->__val_);
-#else
-        return __operator_arrow(__has_operator_addressof<value_type>{});
-#endif
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    value_type*
-    operator->()
-    {
-        _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
-        return _VSTD::addressof(this->__val_);
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr
-    const value_type&
-    operator*() const
-    {
-        _LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
-        return this->__val_;
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    value_type&
-    operator*()
-    {
-        _LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
-        return this->__val_;
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr explicit operator bool() const noexcept {return this->__engaged_;}
-
-	_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY 
-#ifndef _LIBCPP_NO_EXCEPTIONS
-_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
-#endif
-	constexpr void __throw_bad_optional_access() const
-	{
-#ifndef _LIBCPP_NO_EXCEPTIONS
-        throw bad_optional_access();
-#else
-        _VSTD::abort();
-#endif
-	}
-	
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
-    constexpr value_type const& value() const
-    {
-        if (!this->__engaged_)
-            __throw_bad_optional_access();
-        return this->__val_;
-    }
-
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
-    value_type& value()
-    {
-        if (!this->__engaged_)
-            __throw_bad_optional_access();
-        return this->__val_;
-    }
-
-    template <class _Up>
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr value_type value_or(_Up&& __v) const&
-    {
-        static_assert(is_copy_constructible<value_type>::value,
-                      "optional<T>::value_or: T must be copy constructible");
-        static_assert(is_convertible<_Up, value_type>::value,
-                      "optional<T>::value_or: U must be convertible to T");
-        return this->__engaged_ ? this->__val_ :
-                                  static_cast<value_type>(_VSTD::forward<_Up>(__v));
-    }
-
-    template <class _Up>
-    _LIBCPP_INLINE_VISIBILITY
-    value_type value_or(_Up&& __v) &&
-    {
-        static_assert(is_move_constructible<value_type>::value,
-                      "optional<T>::value_or: T must be move constructible");
-        static_assert(is_convertible<_Up, value_type>::value,
-                      "optional<T>::value_or: U must be convertible to T");
-        return this->__engaged_ ? _VSTD::move(this->__val_) :
-                                  static_cast<value_type>(_VSTD::forward<_Up>(__v));
-    }
-
-private:
-    _LIBCPP_INLINE_VISIBILITY
-    value_type const*
-    __operator_arrow(true_type) const
-    {
-        return _VSTD::addressof(this->__val_);
-    }
-
-    _LIBCPP_INLINE_VISIBILITY
-    constexpr
-    value_type const*
-    __operator_arrow(false_type) const
-    {
-        return &this->__val_;
-    }
-};
-
-// Comparisons between optionals
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
-{
-    if (static_cast<bool>(__x) != static_cast<bool>(__y))
-        return false;
-    if (!static_cast<bool>(__x))
-        return true;
-    return *__x == *__y;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
-{
-    return !(__x == __y);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
-{
-    if (!static_cast<bool>(__y))
-        return false;
-    if (!static_cast<bool>(__x))
-        return true;
-    return *__x < *__y;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
-{
-    return __y < __x;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
-{
-    return !(__y < __x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)
-{
-    return !(__x < __y);
-}
-
-
-// Comparisons with nullopt
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator==(const optional<_Tp>& __x, nullopt_t) noexcept
-{
-    return !static_cast<bool>(__x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator==(nullopt_t, const optional<_Tp>& __x) noexcept
-{
-    return !static_cast<bool>(__x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
-{
-    return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
-{
-    return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<(const optional<_Tp>&, nullopt_t) noexcept
-{
-    return false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<(nullopt_t, const optional<_Tp>& __x) noexcept
-{
-    return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
-{
-    return !static_cast<bool>(__x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<=(nullopt_t, const optional<_Tp>&) noexcept
-{
-    return true;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>(const optional<_Tp>& __x, nullopt_t) noexcept
-{
-    return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>(nullopt_t, const optional<_Tp>&) noexcept
-{
-    return false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>=(const optional<_Tp>&, nullopt_t) noexcept
-{
-    return true;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
-{
-    return !static_cast<bool>(__x);
-}
-
-// Comparisons with T
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator==(const optional<_Tp>& __x, const _Tp& __v)
-{
-    return static_cast<bool>(__x) ? *__x == __v : false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator==(const _Tp& __v, const optional<_Tp>& __x)
-{
-    return static_cast<bool>(__x) ? *__x == __v : false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator!=(const optional<_Tp>& __x, const _Tp& __v)
-{
-    return static_cast<bool>(__x) ? !(*__x == __v) : true;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator!=(const _Tp& __v, const optional<_Tp>& __x)
-{
-    return static_cast<bool>(__x) ? !(*__x == __v) : true;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<(const optional<_Tp>& __x, const _Tp& __v)
-{
-    return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<(const _Tp& __v, const optional<_Tp>& __x)
-{
-    return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<=(const optional<_Tp>& __x, const _Tp& __v)
-{
-    return !(__x > __v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator<=(const _Tp& __v, const optional<_Tp>& __x)
-{
-    return !(__v > __x);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>(const optional<_Tp>& __x, const _Tp& __v)
-{
-    return static_cast<bool>(__x) ? __v < __x : false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>(const _Tp& __v, const optional<_Tp>& __x)
-{
-    return static_cast<bool>(__x) ? __x < __v : true;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>=(const optional<_Tp>& __x, const _Tp& __v)
-{
-    return !(__x < __v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-bool
-operator>=(const _Tp& __v, const optional<_Tp>& __x)
-{
-    return !(__v < __x);
-}
-
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
-{
-    __x.swap(__y);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr
-optional<typename decay<_Tp>::type>
-make_optional(_Tp&& __v)
-{
-    return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
-}
-
-_LIBCPP_END_NAMESPACE_LFTS
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<std::experimental::optional<_Tp> >
-{
-    typedef std::experimental::optional<_Tp> argument_type;
-    typedef size_t        result_type;
-
-    _LIBCPP_INLINE_VISIBILITY
-    result_type operator()(const argument_type& __opt) const _NOEXCEPT
-    {
-        return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
-    }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif  // _LIBCPP_STD_VER > 11
-
-_LIBCPP_POP_MACROS
-
-#endif  // _LIBCPP_EXPERIMENTAL_OPTIONAL
+#error "<experimental/optional> has been removed. Use <optional> instead."

+ 0 - 4
include/module.modulemap

@@ -546,10 +546,6 @@ module std [system] {
       header "experimental/numeric"
       export *
     }
-    module optional {
-      header "experimental/optional"
-      export *
-    }
     module propagate_const {
       header "experimental/propagate_const"
       export *

+ 0 - 6
src/optional.cpp

@@ -8,7 +8,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "optional"
-#include "experimental/optional"
 
 namespace std
 {
@@ -21,8 +20,3 @@ const char* bad_optional_access::what() const _NOEXCEPT {
 
 } // std
 
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-
-bad_optional_access::~bad_optional_access() _NOEXCEPT = default;
-
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL

+ 0 - 1
test/libcxx/double_include.sh.cpp

@@ -150,7 +150,6 @@
 #include <experimental/map>
 #include <experimental/memory_resource>
 #include <experimental/numeric>
-#include <experimental/optional>
 #include <experimental/propagate_const>
 #include <experimental/ratio>
 #include <experimental/regex>

+ 0 - 20
test/libcxx/experimental/optional/version.pass.cpp

@@ -1,20 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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 <experimental/optional>
-
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
-int main()
-{
-}

+ 0 - 2
test/libcxx/min_max_macros.sh.cpp

@@ -261,8 +261,6 @@ TEST_MACROS();
 TEST_MACROS();
 #include <experimental/numeric>
 TEST_MACROS();
-#include <experimental/optional>
-TEST_MACROS();
 #include <experimental/propagate_const>
 TEST_MACROS();
 #include <experimental/ratio>

+ 0 - 29
test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp

@@ -1,29 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// <optional>
-
-// class bad_optional_access is default constructible
-
-#include <experimental/optional>
-#include <type_traits>
-
-int main()
-{
-    using std::experimental::bad_optional_access;
-    bad_optional_access ex;
-}

+ 0 - 31
test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp

@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// XFAIL: availability_markup=macosx10.12
-// XFAIL: availability_markup=macosx10.11
-// XFAIL: availability_markup=macosx10.10
-// XFAIL: availability_markup=macosx10.9
-// XFAIL: availability_markup=macosx10.8
-// XFAIL: availability_markup=macosx10.7
-
-// <optional>
-
-// class bad_optional_access : public logic_error
-
-#include <experimental/optional>
-#include <type_traits>
-
-int main()
-{
-    using std::experimental::bad_optional_access;
-
-    static_assert(std::is_base_of<std::logic_error, bad_optional_access>::value, "");
-    static_assert(std::is_convertible<bad_optional_access*, std::logic_error*>::value, "");
-}

+ 0 - 53
test/std/experimental/optional/optional.comp_with_t/equal.pass.cpp

@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator==(const optional<T>& x, const T& v);
-// template <class T> constexpr bool operator==(const T& v, const optional<T>& x);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator == ( const X &lhs, const X &rhs )
-    { return lhs.i_ == rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr T val(2);
-    constexpr O o1;       // disengaged
-    constexpr O o2{1};    // engaged
-    constexpr O o3{val};  // engaged
-
-    static_assert ( !(o1 == T(1)), "" );
-    static_assert (  (o2 == T(1)), "" );
-    static_assert ( !(o3 == T(1)), "" );
-    static_assert (  (o3 == T(2)), "" );
-    static_assert (  (o3 == val),  "" );
-
-    static_assert ( !(T(1) == o1), "" );
-    static_assert (  (T(1) == o2), "" );
-    static_assert ( !(T(1) == o3), "" );
-    static_assert (  (T(2) == o3), "" );
-    static_assert (  (val  == o3), "" );
-    }
-}

+ 0 - 55
test/std/experimental/optional/optional.comp_with_t/greater.pass.cpp

@@ -1,55 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator>(const optional<T>& x, const T& v);
-// template <class T> constexpr bool operator>(const T& v, const optional<T>& x);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr T val(2);
-    constexpr O o1;       // disengaged
-    constexpr O o2{1};    // engaged
-    constexpr O o3{val};  // engaged
-
-    static_assert ( !(o1 > T(1)), "" );
-    static_assert ( !(o2 > T(1)), "" );  // equal
-    static_assert (  (o3 > T(1)), "" );
-    static_assert ( !(o2 >  val), "" );
-    static_assert ( !(o3 >  val), "" );  // equal
-    static_assert ( !(o3 > T(3)), "" );
-
-    static_assert (   (T(1) > o1), "" );
-    static_assert (  !(T(1) > o2), "" ); // equal
-    static_assert (  !(T(1) > o3), "" );
-    static_assert (   (val  > o2), "" );
-    static_assert (  !(val  > o3), "" ); // equal
-    static_assert (   (T(3) > o3), "" );
-    }
-}

+ 0 - 55
test/std/experimental/optional/optional.comp_with_t/greater_equal.pass.cpp

@@ -1,55 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator>=(const optional<T>& x, const T& v);
-// template <class T> constexpr bool operator>=(const T& v, const optional<T>& x);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr T val(2);
-    constexpr O o1;       // disengaged
-    constexpr O o2{1};    // engaged
-    constexpr O o3{val};  // engaged
-
-    static_assert ( !(o1 >= T(1)), "" );
-    static_assert (  (o2 >= T(1)), "" );  // equal
-    static_assert (  (o3 >= T(1)), "" );
-    static_assert ( !(o2 >=  val), "" );
-    static_assert (  (o3 >=  val), "" );  // equal
-    static_assert ( !(o3 >= T(3)), "" );
-
-    static_assert (   (T(1) >= o1), "" );
-    static_assert (   (T(1) >= o2), "" ); // equal
-    static_assert (  !(T(1) >= o3), "" );
-    static_assert (   (val  >= o2), "" );
-    static_assert (   (val  >= o3), "" ); // equal
-    static_assert (   (T(3) >= o3), "" );
-    }
-}

+ 0 - 55
test/std/experimental/optional/optional.comp_with_t/less_equal.pass.cpp

@@ -1,55 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator<=(const optional<T>& x, const T& v);
-// template <class T> constexpr bool operator<=(const T& v, const optional<T>& x);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr T val(2);
-    constexpr O o1;       // disengaged
-    constexpr O o2{1};    // engaged
-    constexpr O o3{val};  // engaged
-
-    static_assert (  (o1 <= T(1)), "" );
-    static_assert (  (o2 <= T(1)), "" );  // equal
-    static_assert ( !(o3 <= T(1)), "" );
-    static_assert (  (o2 <=  val), "" );
-    static_assert (  (o3 <=  val), "" );  // equal
-    static_assert (  (o3 <= T(3)), "" );
-
-    static_assert (  !(T(1) <= o1), "" );
-    static_assert (   (T(1) <= o2), "" ); // equal
-    static_assert (   (T(1) <= o3), "" );
-    static_assert (  !(val  <= o2), "" );
-    static_assert (   (val  <= o3), "" ); // equal
-    static_assert (  !(T(3) <= o3), "" );
-    }
-}

+ 0 - 55
test/std/experimental/optional/optional.comp_with_t/less_than.pass.cpp

@@ -1,55 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator<(const optional<T>& x, const T& v);
-// template <class T> constexpr bool operator<(const T& v, const optional<T>& x);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr T val(2);
-    constexpr O o1;       // disengaged
-    constexpr O o2{1};    // engaged
-    constexpr O o3{val};  // engaged
-
-    static_assert (  (o1 < T(1)), "" );
-    static_assert ( !(o2 < T(1)), "" );  // equal
-    static_assert ( !(o3 < T(1)), "" );
-    static_assert (  (o2 <  val), "" );
-    static_assert ( !(o3 <  val), "" );  // equal
-    static_assert (  (o3 < T(3)), "" );
-
-    static_assert (  !(T(1) < o1), "" );
-    static_assert (  !(T(1) < o2), "" ); // equal
-    static_assert (   (T(1) < o3), "" );
-    static_assert (  !(val  < o2), "" );
-    static_assert (  !(val  < o3), "" ); // equal
-    static_assert (  !(T(3) < o3), "" );
-    }
-}

+ 0 - 53
test/std/experimental/optional/optional.comp_with_t/not_equal.pass.cpp

@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator!=(const optional<T>& x, const T& v);
-// template <class T> constexpr bool operator!=(const T& v, const optional<T>& x);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator == ( const X &lhs, const X &rhs )
-    { return lhs.i_ == rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr T val(2);
-    constexpr O o1;       // disengaged
-    constexpr O o2{1};    // engaged
-    constexpr O o3{val};  // engaged
-
-    static_assert (  (o1 != T(1)), "" );
-    static_assert ( !(o2 != T(1)), "" );
-    static_assert (  (o3 != T(1)), "" );
-    static_assert ( !(o3 != T(2)), "" );
-    static_assert ( !(o3 != val),  "" );
-
-    static_assert (  (T(1) != o1), "" );
-    static_assert ( !(T(1) != o2), "" );
-    static_assert (  (T(1) != o3), "" );
-    static_assert ( !(T(2) != o3), "" );
-    static_assert ( !(val  != o3), "" );
-    }
-}

+ 0 - 12
test/std/experimental/optional/optional.defs/tested_elsewhere.pass.cpp

@@ -1,12 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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()
-{
-}

+ 0 - 12
test/std/experimental/optional/optional.general/nothing_to_do.pass.cpp

@@ -1,12 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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()
-{
-}

+ 0 - 46
test/std/experimental/optional/optional.hash/hash.pass.cpp

@@ -1,46 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> struct hash<optional<T>>;
-
-#include <experimental/optional>
-#include <string>
-#include <memory>
-#include <cassert>
-
-
-int main()
-{
-    using std::experimental::optional;
-
-    {
-        typedef int T;
-        optional<T> opt;
-        assert(std::hash<optional<T>>{}(opt) == 0);
-        opt = 2;
-        assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
-    }
-    {
-        typedef std::string T;
-        optional<T> opt;
-        assert(std::hash<optional<T>>{}(opt) == 0);
-        opt = std::string("123");
-        assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
-    }
-    {
-        typedef std::unique_ptr<int> T;
-        optional<T> opt;
-        assert(std::hash<optional<T>>{}(opt) == 0);
-        opt = std::unique_ptr<int>(new int(3));
-        assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
-    }
-}

+ 0 - 36
test/std/experimental/optional/optional.inplace/in_place_t.pass.cpp

@@ -1,36 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// struct in_place_t{};
-// constexpr in_place_t in_place{};
-
-#include <experimental/optional>
-#include <type_traits>
-
-using std::experimental::optional;
-using std::experimental::in_place_t;
-using std::experimental::in_place;
-
-constexpr
-int
-test(const in_place_t&)
-{
-    return 3;
-}
-
-int main()
-{
-    static_assert((std::is_class<in_place_t>::value), "");
-    static_assert((std::is_empty<in_place_t>::value), "");
-
-    static_assert(test(in_place) == 3, "");
-}

+ 0 - 39
test/std/experimental/optional/optional.nullops/equal.pass.cpp

@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept;
-// template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept;
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    {
-    typedef int T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2{1};  // engaged
-
-    static_assert (  (nullopt == o1), "" );
-    static_assert ( !(nullopt == o2), "" );
-    static_assert (  (o1 == nullopt), "" );
-    static_assert ( !(o2 == nullopt), "" );
-
-    static_assert (noexcept(nullopt == o1), "");
-    static_assert (noexcept(o1 == nullopt), "");
-    }
-}

+ 0 - 39
test/std/experimental/optional/optional.nullops/greater.pass.cpp

@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept;
-// template <class T> constexpr bool operator>(nullopt_t, const optional<T>& x) noexcept;
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    {
-    typedef int T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2{1};  // engaged
-
-    static_assert ( !(nullopt > o1), "" );
-    static_assert ( !(nullopt > o2), "" );
-    static_assert ( !(o1 > nullopt), "" );
-    static_assert (  (o2 > nullopt), "" );
-
-    static_assert (noexcept(nullopt > o1), "");
-    static_assert (noexcept(o1 > nullopt), "");
-    }
-}

+ 0 - 39
test/std/experimental/optional/optional.nullops/greater_equal.pass.cpp

@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator>=(const optional<T>& x, nullopt_t) noexcept;
-// template <class T> constexpr bool operator>=(nullopt_t, const optional<T>& x) noexcept;
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    {
-    typedef int T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2{1};  // engaged
-
-    static_assert (  (nullopt >= o1), "" );
-    static_assert ( !(nullopt >= o2), "" );
-    static_assert (  (o1 >= nullopt), "" );
-    static_assert (  (o2 >= nullopt), "" );
-
-    static_assert (noexcept(nullopt >= o1), "");
-    static_assert (noexcept(o1 >= nullopt), "");
-    }
-}

+ 0 - 43
test/std/experimental/optional/optional.nullops/less_equal.pass.cpp

@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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> constexpr bool operator<=(const optional<T>& x, nullopt_t) noexcept;
-// template <class T> constexpr bool operator<=(nullopt_t, const optional<T>& x) noexcept;
-
-#include <experimental/optional>
-
-#include "test_macros.h"
-
-int main()
-{
-#if TEST_STD_VER > 11
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    {
-    typedef int T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2{1};  // engaged
-
-    static_assert (  (nullopt <= o1), "" );
-    static_assert (  (nullopt <= o2), "" );
-    static_assert (  (o1 <= nullopt), "" );
-    static_assert ( !(o2 <= nullopt), "" );
-
-    static_assert (noexcept(nullopt <= o1), "");
-    static_assert (noexcept(o1 <= nullopt), "");
-    }
-#endif
-}

+ 0 - 39
test/std/experimental/optional/optional.nullops/less_than.pass.cpp

@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator<(const optional<T>& x, nullopt_t) noexcept;
-// template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept;
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    {
-    typedef int T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2{1};  // engaged
-
-    static_assert ( !(nullopt < o1), "" );
-    static_assert (  (nullopt < o2), "" );
-    static_assert ( !(o1 < nullopt), "" );
-    static_assert ( !(o2 < nullopt), "" );
-
-    static_assert (noexcept(nullopt < o1), "");
-    static_assert (noexcept(o1 < nullopt), "");
-    }
-}

+ 0 - 39
test/std/experimental/optional/optional.nullops/not_equal.pass.cpp

@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept;
-// template <class T> constexpr bool operator!=(nullopt_t, const optional<T>& x) noexcept;
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    {
-    typedef int T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2{1};  // engaged
-
-    static_assert ( !(nullopt != o1), "" );
-    static_assert (  (nullopt != o2), "" );
-    static_assert ( !(o1 != nullopt), "" );
-    static_assert (  (o2 != nullopt), "" );
-
-    static_assert (noexcept(nullopt != o1), "");
-    static_assert (noexcept(o1 != nullopt), "");
-    }
-}

+ 0 - 38
test/std/experimental/optional/optional.nullopt/nullopt_t.pass.cpp

@@ -1,38 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// struct nullopt_t{see below};
-// constexpr nullopt_t nullopt(unspecified);
-
-#include <experimental/optional>
-#include <type_traits>
-
-using std::experimental::optional;
-using std::experimental::nullopt_t;
-using std::experimental::nullopt;
-
-constexpr
-int
-test(const nullopt_t&)
-{
-    return 3;
-}
-
-int main()
-{
-    static_assert((std::is_class<nullopt_t>::value), "");
-    static_assert((std::is_empty<nullopt_t>::value), "");
-    static_assert((std::is_literal_type<nullopt_t>::value), "");
-    static_assert((!std::is_default_constructible<nullopt_t>::value), "");
-
-    static_assert(test(nullopt) == 3, "");
-}

+ 0 - 80
test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp

@@ -1,80 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class U> optional<T>& operator=(U&& v);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-#include <memory>
-
-using std::experimental::optional;
-
-struct AllowConstAssign {
-  AllowConstAssign() {}
-  AllowConstAssign(AllowConstAssign const&) {}
-  AllowConstAssign const& operator=(AllowConstAssign const&) const {
-      return *this;
-  }
-};
-
-struct X
-{
-};
-
-int main()
-{
-    static_assert(std::is_assignable<optional<int>, int>::value, "");
-    static_assert(std::is_assignable<optional<int>, int&>::value, "");
-    static_assert(std::is_assignable<optional<int>&, int>::value, "");
-    static_assert(std::is_assignable<optional<int>&, int&>::value, "");
-    static_assert(std::is_assignable<optional<int>&, const int&>::value, "");
-    static_assert(!std::is_assignable<const optional<int>&, const int&>::value, "");
-    static_assert(!std::is_assignable<optional<int>, X>::value, "");
-    {
-        optional<int> opt;
-        opt = 1;
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 1);
-    }
-    {
-        optional<int> opt;
-        const int i = 2;
-        opt = i;
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == i);
-    }
-    {
-        optional<int> opt(3);
-        const int i = 2;
-        opt = i;
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == i);
-    }
-    {
-        optional<const AllowConstAssign> opt;
-        const AllowConstAssign other;
-        opt = other;
-    }
-    {
-        optional<std::unique_ptr<int>> opt;
-        opt = std::unique_ptr<int>(new int(3));
-        assert(static_cast<bool>(opt) == true);
-        assert(**opt == 3);
-    }
-    {
-        optional<std::unique_ptr<int>> opt(std::unique_ptr<int>(new int(2)));
-        opt = std::unique_ptr<int>(new int(3));
-        assert(static_cast<bool>(opt) == true);
-        assert(**opt == 3);
-    }
-}

+ 0 - 101
test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp

@@ -1,101 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// optional<T>& operator=(const optional<T>& rhs);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-struct AllowConstAssign {
-  AllowConstAssign(AllowConstAssign const&) {}
-  AllowConstAssign const& operator=(AllowConstAssign const&) const {
-      return *this;
-  }
-};
-
-struct X
-{
-    static bool throw_now;
-
-    X() = default;
-    X(const X&)
-    {
-        if (throw_now)
-            TEST_THROW(6);
-    }
-};
-
-bool X::throw_now = false;
-
-int main()
-{
-    {
-        optional<int> opt;
-        constexpr optional<int> opt2;
-        opt = opt2;
-        static_assert(static_cast<bool>(opt2) == false, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-    }
-    {
-        optional<const AllowConstAssign> opt;
-        optional<const AllowConstAssign> opt2;
-        opt = opt2;
-    }
-    {
-        optional<int> opt;
-        constexpr optional<int> opt2(2);
-        opt = opt2;
-        static_assert(static_cast<bool>(opt2) == true, "");
-        static_assert(*opt2 == 2, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-        assert(*opt == *opt2);
-    }
-    {
-        optional<int> opt(3);
-        constexpr optional<int> opt2;
-        opt = opt2;
-        static_assert(static_cast<bool>(opt2) == false, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-    }
-    {
-        optional<int> opt(3);
-        constexpr optional<int> opt2(2);
-        opt = opt2;
-        static_assert(static_cast<bool>(opt2) == true, "");
-        static_assert(*opt2 == 2, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-        assert(*opt == *opt2);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        optional<X> opt;
-        optional<X> opt2(X{});
-        assert(static_cast<bool>(opt2) == true);
-        try
-        {
-            X::throw_now = true;
-            opt = opt2;
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-            assert(static_cast<bool>(opt) == false);
-        }
-    }
-#endif
-}

+ 0 - 153
test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp

@@ -1,153 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class... Args> void optional<T>::emplace(Args&&... args);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-#include <memory>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-class X
-{
-    int i_;
-    int j_ = 0;
-public:
-    X() : i_(0) {}
-    X(int i) : i_(i) {}
-    X(int i, int j) : i_(i), j_(j) {}
-
-    friend bool operator==(const X& x, const X& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-class Y
-{
-public:
-    static bool dtor_called;
-    Y() = default;
-    ~Y() {dtor_called = true;}
-};
-
-bool Y::dtor_called = false;
-
-class Z
-{
-public:
-    static bool dtor_called;
-    Z() = default;
-    Z(int) {TEST_THROW(6);}
-    ~Z() {dtor_called = true;}
-};
-
-bool Z::dtor_called = false;
-
-int main()
-{
-    {
-        optional<int> opt;
-        opt.emplace();
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 0);
-    }
-    {
-        optional<int> opt;
-        opt.emplace(1);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 1);
-    }
-    {
-        optional<int> opt(2);
-        opt.emplace();
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 0);
-    }
-    {
-        optional<int> opt(2);
-        opt.emplace(1);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 1);
-    }
-    {
-        optional<const int> opt(2);
-        opt.emplace(1);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 1);
-    }
-    {
-        optional<X> opt;
-        opt.emplace();
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X());
-    }
-    {
-        optional<X> opt;
-        opt.emplace(1);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X(1));
-    }
-    {
-        optional<X> opt;
-        opt.emplace(1, 2);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X(1, 2));
-    }
-    {
-        optional<X> opt(X{3});
-        opt.emplace();
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X());
-    }
-    {
-        optional<X> opt(X{3});
-        opt.emplace(1);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X(1));
-    }
-    {
-        optional<X> opt(X{3});
-        opt.emplace(1, 2);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X(1, 2));
-    }
-    {
-        Y y;
-        {
-            optional<Y> opt(y);
-            assert(Y::dtor_called == false);
-            opt.emplace();
-            assert(Y::dtor_called == true);
-        }
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        Z z;
-        optional<Z> opt(z);
-        try
-        {
-            assert(static_cast<bool>(opt) == true);
-            assert(Z::dtor_called == false);
-            opt.emplace(1);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-            assert(static_cast<bool>(opt) == false);
-            assert(Z::dtor_called == true);
-        }
-    }
-#endif
-}

+ 0 - 126
test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp

@@ -1,126 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class U, class... Args>
-//   void optional<T>::emplace(initializer_list<U> il, Args&&... args);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-#include <vector>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-class X
-{
-    int i_;
-    int j_ = 0;
-public:
-    static bool dtor_called;
-    constexpr X() : i_(0) {}
-    constexpr X(int i) : i_(i) {}
-    constexpr X(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1]) {}
-    ~X() {dtor_called = true;}
-
-    friend constexpr bool operator==(const X& x, const X& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-bool X::dtor_called = false;
-
-class Y
-{
-    int i_;
-    int j_ = 0;
-public:
-    constexpr Y() : i_(0) {}
-    constexpr Y(int i) : i_(i) {}
-    constexpr Y(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1]) {}
-
-    friend constexpr bool operator==(const Y& x, const Y& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-class Z
-{
-    int i_;
-    int j_ = 0;
-public:
-    static bool dtor_called;
-    constexpr Z() : i_(0) {}
-    constexpr Z(int i) : i_(i) {}
-    Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
-        {TEST_THROW(6);}
-    ~Z() {dtor_called = true;}
-
-    friend constexpr bool operator==(const Z& x, const Z& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-bool Z::dtor_called = false;
-
-int main()
-{
-    {
-        X x;
-        {
-            optional<X> opt(x);
-            assert(X::dtor_called == false);
-            opt.emplace({1, 2});
-            assert(X::dtor_called == true);
-            assert(*opt == X({1, 2}));
-        }
-    }
-    X::dtor_called = false;
-    {
-        X x;
-        {
-            optional<const X> opt(x);
-            assert(X::dtor_called == false);
-            opt.emplace({1, 2});
-            assert(X::dtor_called == true);
-            assert(*opt == X({1, 2}));
-        }
-    }
-    {
-        optional<std::vector<int>> opt;
-        opt.emplace({1, 2, 3}, std::allocator<int>());
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == std::vector<int>({1, 2, 3}));
-    }
-    {
-        optional<Y> opt;
-        opt.emplace({1, 2});
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == Y({1, 2}));
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        Z z;
-        optional<Z> opt(z);
-        try
-        {
-            assert(static_cast<bool>(opt) == true);
-            assert(Z::dtor_called == false);
-            opt.emplace({1, 2});
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-            assert(static_cast<bool>(opt) == false);
-            assert(Z::dtor_called == true);
-        }
-    }
-#endif
-}

+ 0 - 114
test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp

@@ -1,114 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// optional<T>& operator=(optional<T>&& rhs)
-//     noexcept(is_nothrow_move_assignable<T>::value &&
-//              is_nothrow_move_constructible<T>::value);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-struct AllowConstAssign {
-  AllowConstAssign(AllowConstAssign const&) {}
-  AllowConstAssign const& operator=(AllowConstAssign const&) const {
-      return *this;
-  }
-};
-
-struct X
-{
-    static bool throw_now;
-
-    X() = default;
-    X(X&&)
-    {
-        if (throw_now)
-            TEST_THROW(6);
-    }
-    X& operator=(X&&) noexcept
-    {
-        return *this;
-    }
-};
-
-bool X::throw_now = false;
-
-struct Y {};
-
-int main()
-{
-    {
-        static_assert(std::is_nothrow_move_assignable<optional<int>>::value, "");
-        optional<int> opt;
-        constexpr optional<int> opt2;
-        opt = std::move(opt2);
-        static_assert(static_cast<bool>(opt2) == false, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-    }
-    {
-        optional<int> opt;
-        constexpr optional<int> opt2(2);
-        opt = std::move(opt2);
-        static_assert(static_cast<bool>(opt2) == true, "");
-        static_assert(*opt2 == 2, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-        assert(*opt == *opt2);
-    }
-    {
-        optional<int> opt(3);
-        constexpr optional<int> opt2;
-        opt = std::move(opt2);
-        static_assert(static_cast<bool>(opt2) == false, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-    }
-    {
-        optional<int> opt(3);
-        constexpr optional<int> opt2(2);
-        opt = std::move(opt2);
-        static_assert(static_cast<bool>(opt2) == true, "");
-        static_assert(*opt2 == 2, "");
-        assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
-        assert(*opt == *opt2);
-    }
-    {
-        optional<const AllowConstAssign> opt;
-        optional<const AllowConstAssign> opt2;
-        opt = std::move(opt2);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        static_assert(!std::is_nothrow_move_assignable<optional<X>>::value, "");
-        optional<X> opt;
-        optional<X> opt2(X{});
-        assert(static_cast<bool>(opt2) == true);
-        try
-        {
-            X::throw_now = true;
-            opt = std::move(opt2);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-            assert(static_cast<bool>(opt) == false);
-        }
-    }
-#endif
-    {
-        static_assert(std::is_nothrow_move_assignable<optional<Y>>::value, "");
-    }
-}

+ 0 - 62
test/std/experimental/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp

@@ -1,62 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// optional<T>& operator=(nullopt_t) noexcept;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-using std::experimental::nullopt_t;
-using std::experimental::nullopt;
-
-struct X
-{
-    static bool dtor_called;
-    ~X() {dtor_called = true;}
-};
-
-bool X::dtor_called = false;
-
-int main()
-{
-    {
-        optional<int> opt;
-        static_assert(noexcept(opt = nullopt) == true, "");
-        opt = nullopt;
-        assert(static_cast<bool>(opt) == false);
-    }
-    {
-        optional<int> opt(3);
-        opt = nullopt;
-        assert(static_cast<bool>(opt) == false);
-    }
-    {
-        optional<X> opt;
-        static_assert(noexcept(opt = nullopt) == true, "");
-        assert(X::dtor_called == false);
-        opt = nullopt;
-        assert(X::dtor_called == false);
-        assert(static_cast<bool>(opt) == false);
-    }
-    {
-        X x;
-        {
-            optional<X> opt(x);
-            assert(X::dtor_called == false);
-            opt = nullopt;
-            assert(X::dtor_called == true);
-            assert(static_cast<bool>(opt) == false);
-        }
-    }
-}

+ 0 - 116
test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp

@@ -1,116 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-
-// <optional>
-
-// constexpr optional(const T& v);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-class X
-{
-    int i_;
-public:
-    X(int i) : i_(i) {}
-
-    friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
-};
-
-class Y
-{
-    int i_;
-public:
-    constexpr Y(int i) : i_(i) {}
-
-    friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
-};
-
-class Z
-{
-public:
-    Z(int)  {}
-    Z(const Z&) {TEST_THROW(6);}
-};
-
-
-int main()
-{
-    {
-        typedef int T;
-        constexpr T t(5);
-        constexpr optional<T> opt(t);
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == 5, "");
-
-        struct test_constexpr_ctor
-            : public optional<T>
-        {
-            constexpr test_constexpr_ctor(const T&) {}
-        };
-
-    }
-    {
-        typedef double T;
-        constexpr T t(3);
-        constexpr optional<T> opt(t);
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == 3, "");
-
-        struct test_constexpr_ctor
-            : public optional<T>
-        {
-            constexpr test_constexpr_ctor(const T&) {}
-        };
-
-    }
-    {
-        typedef X T;
-        const T t(3);
-        optional<T> opt(t);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 3);
-    }
-    {
-        typedef Y T;
-        constexpr T t(3);
-        constexpr optional<T> opt(t);
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == 3, "");
-
-        struct test_constexpr_ctor
-            : public optional<T>
-        {
-            constexpr test_constexpr_ctor(const T&) {}
-        };
-
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        typedef Z T;
-        try
-        {
-            const T t(3);
-            optional<T> opt(t);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-        }
-    }
-#endif
-}

+ 0 - 139
test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp

@@ -1,139 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// optional(const optional<T>& rhs);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-template <class T>
-void
-test(const optional<T>& rhs, bool is_going_to_throw = false)
-{
-    bool rhs_engaged = static_cast<bool>(rhs);
-#ifdef TEST_HAS_NO_EXCEPTIONS
-    if (is_going_to_throw)
-        return;
-#else
-    try
-#endif
-    {
-        optional<T> lhs = rhs;
-        assert(is_going_to_throw == false);
-        assert(static_cast<bool>(lhs) == rhs_engaged);
-        if (rhs_engaged)
-            assert(*lhs == *rhs);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    catch (int i)
-    {
-        assert(i == 6);
-        assert(is_going_to_throw);
-    }
-#endif
-}
-
-class X
-{
-    int i_;
-public:
-    X(int i) : i_(i) {}
-    X(const X& x) : i_(x.i_) {}
-    ~X() {i_ = 0;}
-    friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
-};
-
-class Y
-{
-    int i_;
-public:
-    Y(int i) : i_(i) {}
-    Y(const Y& x) : i_(x.i_) {}
-
-    friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
-};
-
-int count = 0;
-
-class Z
-{
-    int i_;
-public:
-    Z(int i) : i_(i) {}
-    Z(const Z&)
-    {
-        if (++count == 2)
-            TEST_THROW(6);
-    }
-
-    friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
-};
-
-
-int main()
-{
-    {
-        typedef int T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef int T;
-        optional<T> rhs(3);
-        test(rhs);
-    }
-    {
-        typedef const int T;
-        optional<T> rhs(3);
-        test(rhs);
-    }
-    {
-        typedef X T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef X T;
-        optional<T> rhs(X(3));
-        test(rhs);
-    }
-    {
-        typedef const X T;
-        optional<T> rhs(X(3));
-        test(rhs);
-    }
-    {
-        typedef Y T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef Y T;
-        optional<T> rhs(Y(3));
-        test(rhs);
-    }
-    {
-        typedef Z T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef Z T;
-        optional<T> rhs(Z(3));
-        test(rhs, true);
-    }
-}

+ 0 - 62
test/std/experimental/optional/optional.object/optional.object.ctor/default.pass.cpp

@@ -1,62 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// constexpr optional() noexcept;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-template <class Opt>
-void
-test_constexpr()
-{
-    static_assert(std::is_nothrow_default_constructible<Opt>::value, "");
-    constexpr Opt opt;
-    static_assert(static_cast<bool>(opt) == false, "");
-
-    struct test_constexpr_ctor
-        : public Opt
-    {
-        constexpr test_constexpr_ctor() {}
-    };
-
-}
-
-template <class Opt>
-void
-test()
-{
-    static_assert(std::is_nothrow_default_constructible<Opt>::value, "");
-    Opt opt;
-    assert(static_cast<bool>(opt) == false);
-
-    struct test_constexpr_ctor
-        : public Opt
-    {
-        constexpr test_constexpr_ctor() {}
-    };
-}
-
-struct X
-{
-    X();
-};
-
-int main()
-{
-    test_constexpr<optional<int>>();
-    test_constexpr<optional<int*>>();
-    test<optional<X>>();
-}

+ 0 - 144
test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp

@@ -1,144 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-
-// <optional>
-
-// template <class... Args>
-//   constexpr explicit optional(in_place_t, Args&&... args);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-using std::experimental::in_place_t;
-using std::experimental::in_place;
-
-class X
-{
-    int i_;
-    int j_ = 0;
-public:
-    X() : i_(0) {}
-    X(int i) : i_(i) {}
-    X(int i, int j) : i_(i), j_(j) {}
-
-    ~X() {}
-
-    friend bool operator==(const X& x, const X& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-class Y
-{
-    int i_;
-    int j_ = 0;
-public:
-    constexpr Y() : i_(0) {}
-    constexpr Y(int i) : i_(i) {}
-    constexpr Y(int i, int j) : i_(i), j_(j) {}
-
-    friend constexpr bool operator==(const Y& x, const Y& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-class Z
-{
-public:
-    Z(int) {TEST_THROW(6);}
-};
-
-
-int main()
-{
-    {
-        constexpr optional<int> opt(in_place, 5);
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == 5, "");
-
-        struct test_constexpr_ctor
-            : public optional<int>
-        {
-            constexpr test_constexpr_ctor(in_place_t, int i)
-                : optional<int>(in_place, i) {}
-        };
-
-    }
-    {
-        const optional<X> opt(in_place);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X());
-    }
-    {
-        const optional<X> opt(in_place, 5);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X(5));
-    }
-    {
-        const optional<X> opt(in_place, 5, 4);
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == X(5, 4));
-    }
-    {
-        constexpr optional<Y> opt(in_place);
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == Y(), "");
-
-        struct test_constexpr_ctor
-            : public optional<Y>
-        {
-            constexpr test_constexpr_ctor(in_place_t)
-                : optional<Y>(in_place) {}
-        };
-
-    }
-    {
-        constexpr optional<Y> opt(in_place, 5);
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == Y(5), "");
-
-        struct test_constexpr_ctor
-            : public optional<Y>
-        {
-            constexpr test_constexpr_ctor(in_place_t, int i)
-                : optional<Y>(in_place, i) {}
-        };
-
-    }
-    {
-        constexpr optional<Y> opt(in_place, 5, 4);
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == Y(5, 4), "");
-
-        struct test_constexpr_ctor
-            : public optional<Y>
-        {
-            constexpr test_constexpr_ctor(in_place_t, int i, int j)
-                : optional<Y>(in_place, i, j) {}
-        };
-
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        try
-        {
-            const optional<Z> opt(in_place, 1);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-        }
-    }
-#endif
-}

+ 0 - 118
test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp

@@ -1,118 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class U, class... Args>
-//     constexpr
-//     explicit optional(in_place_t, initializer_list<U> il, Args&&... args);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <vector>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-using std::experimental::in_place_t;
-using std::experimental::in_place;
-
-class X
-{
-    int i_;
-    int j_ = 0;
-public:
-    X() : i_(0) {}
-    X(int i) : i_(i) {}
-    X(int i, int j) : i_(i), j_(j) {}
-
-    ~X() {}
-
-    friend bool operator==(const X& x, const X& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-class Y
-{
-    int i_;
-    int j_ = 0;
-public:
-    constexpr Y() : i_(0) {}
-    constexpr Y(int i) : i_(i) {}
-    constexpr Y(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1]) {}
-
-    friend constexpr bool operator==(const Y& x, const Y& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-class Z
-{
-    int i_;
-    int j_ = 0;
-public:
-    constexpr Z() : i_(0) {}
-    constexpr Z(int i) : i_(i) {}
-    Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
-        {TEST_THROW(6);}
-
-    friend constexpr bool operator==(const Z& x, const Z& y)
-        {return x.i_ == y.i_ && x.j_ == y.j_;}
-};
-
-int main()
-{
-    {
-        static_assert(!std::is_constructible<X, std::initializer_list<int>&>::value, "");
-        static_assert(!std::is_constructible<optional<X>, std::initializer_list<int>&>::value, "");
-    }
-    {
-        optional<std::vector<int>> opt(in_place, {3, 1});
-        assert(static_cast<bool>(opt) == true);
-        assert((*opt == std::vector<int>{3, 1}));
-        assert(opt->size() == 2);
-    }
-    {
-        optional<std::vector<int>> opt(in_place, {3, 1}, std::allocator<int>());
-        assert(static_cast<bool>(opt) == true);
-        assert((*opt == std::vector<int>{3, 1}));
-        assert(opt->size() == 2);
-    }
-    {
-        static_assert(std::is_constructible<optional<Y>, std::initializer_list<int>&>::value, "");
-        constexpr optional<Y> opt(in_place, {3, 1});
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == Y{3, 1}, "");
-
-        struct test_constexpr_ctor
-            : public optional<Y>
-        {
-            constexpr test_constexpr_ctor(in_place_t, std::initializer_list<int> i)
-                : optional<Y>(in_place, i) {}
-        };
-
-        constexpr test_constexpr_ctor dopt(in_place, {42, 101, -1});
-        static_assert(*dopt == Y{42, 101, -1}, "");
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        static_assert(std::is_constructible<optional<Z>, std::initializer_list<int>&>::value, "");
-        try
-        {
-            optional<Z> opt(in_place, {3, 1});
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-        }
-    }
-#endif
-}

+ 0 - 149
test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp

@@ -1,149 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// optional(optional<T>&& rhs) noexcept(is_nothrow_move_constructible<T>::value);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-template <class T>
-void
-test(optional<T>& rhs, bool is_going_to_throw = false)
-{
-    static_assert(std::is_nothrow_move_constructible<optional<T>>::value ==
-                  std::is_nothrow_move_constructible<T>::value, "");
-    bool rhs_engaged = static_cast<bool>(rhs);
-#ifdef TEST_HAS_NO_EXCEPTIONS
-    if (is_going_to_throw)
-        return;
-#else
-    try
-#endif
-    {
-        optional<T> lhs = std::move(rhs);
-        assert(is_going_to_throw == false);
-        assert(static_cast<bool>(lhs) == rhs_engaged);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    catch (int i)
-    {
-        assert(i == 6);
-        assert(is_going_to_throw);
-    }
-#endif
-}
-
-class X
-{
-    int i_;
-public:
-    X(int i) : i_(i) {}
-    X(X&& x) : i_(x.i_) {x.i_ = 0;}
-    ~X() {i_ = 0;}
-    friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
-};
-
-class Y
-{
-    int i_;
-public:
-    Y(int i) : i_(i) {}
-    Y(Y&& x) noexcept : i_(x.i_) {x.i_ = 0;}
-
-    friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
-};
-
-int count = 0;
-
-class Z
-{
-    int i_;
-public:
-    Z(int i) : i_(i) {}
-    Z(Z&&)
-    {
-        if (++count == 2)
-            TEST_THROW(6);
-    }
-
-    friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
-};
-
-
-class ConstMovable
-{
-    int i_;
-public:
-    ConstMovable(int i) : i_(i) {}
-    ConstMovable(const ConstMovable&& x) : i_(x.i_) {}
-    ~ConstMovable() {i_ = 0;}
-    friend bool operator==(const ConstMovable& x, const ConstMovable& y) {return x.i_ == y.i_;}
-};
-
-int main()
-{
-    {
-        typedef int T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef int T;
-        optional<T> rhs(3);
-        test(rhs);
-    }
-    {
-        typedef const int T;
-        optional<T> rhs(3);
-        test(rhs);
-    }
-    {
-        typedef X T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef X T;
-        optional<T> rhs(X(3));
-        test(rhs);
-    }
-    {
-        typedef const ConstMovable T;
-        optional<T> rhs(ConstMovable(3));
-        test(rhs);
-    }
-    {
-        typedef Y T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef Y T;
-        optional<T> rhs(Y(3));
-        test(rhs);
-    }
-    {
-        typedef Z T;
-        optional<T> rhs;
-        test(rhs);
-    }
-    {
-        typedef Z T;
-        optional<T> rhs(Z(3));
-        test(rhs, true);
-    }
-}

+ 0 - 63
test/std/experimental/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp

@@ -1,63 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// constexpr optional(nullopt_t) noexcept;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-using std::experimental::nullopt_t;
-using std::experimental::nullopt;
-
-template <class Opt>
-void
-test_constexpr()
-{
-    static_assert(noexcept(Opt(nullopt)), "");
-    constexpr Opt opt(nullopt);
-    static_assert(static_cast<bool>(opt) == false, "");
-
-    struct test_constexpr_ctor
-        : public Opt
-    {
-        constexpr test_constexpr_ctor() {}
-    };
-}
-
-template <class Opt>
-void
-test()
-{
-    static_assert(noexcept(Opt(nullopt)), "");
-    Opt opt(nullopt);
-    assert(static_cast<bool>(opt) == false);
-
-    struct test_constexpr_ctor
-        : public Opt
-    {
-        constexpr test_constexpr_ctor() {}
-    };
-}
-
-struct X
-{
-    X();
-};
-
-int main()
-{
-    test_constexpr<optional<int>>();
-    test_constexpr<optional<int*>>();
-    test<optional<X>>();
-}

+ 0 - 110
test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp

@@ -1,110 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-
-// <optional>
-
-// constexpr optional(T&& v);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-class X
-{
-    int i_;
-public:
-    X(int i) : i_(i) {}
-    X(X&& x) : i_(x.i_) {}
-
-    friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
-};
-
-class Y
-{
-    int i_;
-public:
-    constexpr Y(int i) : i_(i) {}
-    constexpr Y(Y&& x) : i_(x.i_) {}
-
-    friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
-};
-
-class Z
-{
-public:
-    Z(int) {}
-    Z(Z&&) {TEST_THROW(6);}
-};
-
-
-int main()
-{
-    {
-        typedef int T;
-        constexpr optional<T> opt(T(5));
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == 5, "");
-
-        struct test_constexpr_ctor
-            : public optional<T>
-        {
-            constexpr test_constexpr_ctor(T&&) {}
-        };
-    }
-    {
-        typedef double T;
-        constexpr optional<T> opt(T(3));
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == 3, "");
-
-        struct test_constexpr_ctor
-            : public optional<T>
-        {
-            constexpr test_constexpr_ctor(T&&) {}
-        };
-    }
-    {
-        typedef X T;
-        optional<T> opt(T(3));
-        assert(static_cast<bool>(opt) == true);
-        assert(*opt == 3);
-    }
-    {
-        typedef Y T;
-        constexpr optional<T> opt(T(3));
-        static_assert(static_cast<bool>(opt) == true, "");
-        static_assert(*opt == 3, "");
-
-        struct test_constexpr_ctor
-            : public optional<T>
-        {
-            constexpr test_constexpr_ctor(T&&) {}
-        };
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        typedef Z T;
-        try
-        {
-            optional<T> opt(T(3));
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-        }
-    }
-#endif
-}

+ 0 - 54
test/std/experimental/optional/optional.object/optional.object.dtor/dtor.pass.cpp

@@ -1,54 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// ~optional();
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-class X
-{
-public:
-    static bool dtor_called;
-    X() = default;
-    ~X() {dtor_called = true;}
-};
-
-bool X::dtor_called = false;
-
-int main()
-{
-    {
-        typedef int T;
-        static_assert(std::is_trivially_destructible<T>::value, "");
-        static_assert(std::is_trivially_destructible<optional<T>>::value, "");
-    }
-    {
-        typedef double T;
-        static_assert(std::is_trivially_destructible<T>::value, "");
-        static_assert(std::is_trivially_destructible<optional<T>>::value, "");
-    }
-    {
-        typedef X T;
-        static_assert(!std::is_trivially_destructible<T>::value, "");
-        static_assert(!std::is_trivially_destructible<optional<T>>::value, "");
-        {
-            X x;
-            optional<X> opt{x};
-            assert(X::dtor_called == false);
-        }
-        assert(X::dtor_called == true);
-    }
-}

+ 0 - 31
test/std/experimental/optional/optional.object/optional.object.observe/bool.pass.cpp

@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// constexpr explicit optional<T>::operator bool() const noexcept;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-int main()
-{
-    using std::experimental::optional;
-
-    {
-        constexpr optional<int> opt;
-        static_assert(!opt, "");
-    }
-    {
-        constexpr optional<int> opt(0);
-        static_assert(opt, "");
-    }
-}

+ 0 - 44
test/std/experimental/optional/optional.object/optional.object.observe/dereference.pass.cpp

@@ -1,44 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// T& optional<T>::operator*();
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
-    constexpr int test() const {return 3;}
-    int test() {return 4;}
-};
-
-int main()
-{
-    {
-        optional<X> opt(X{});
-        assert((*opt).test() == 4);
-    }
-#ifdef _LIBCPP_DEBUG
-    {
-        optional<X> opt;
-        assert((*opt).test() == 3);
-        assert(false);
-    }
-#endif  // _LIBCPP_DEBUG
-}

+ 0 - 52
test/std/experimental/optional/optional.object/optional.object.observe/dereference_const.pass.cpp

@@ -1,52 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// constexpr const T& optional<T>::operator*() const;
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
-    constexpr int test() const {return 3;}
-};
-
-struct Y
-{
-    int test() const {return 2;}
-};
-
-int main()
-{
-    {
-        constexpr optional<X> opt(X{});
-        static_assert((*opt).test() == 3, "");
-    }
-    {
-        constexpr optional<Y> opt(Y{});
-        assert((*opt).test() == 2);
-    }
-#ifdef _LIBCPP_DEBUG
-    {
-        const optional<X> opt;
-        assert((*opt).test() == 3);
-        assert(false);
-    }
-#endif  // _LIBCPP_DEBUG
-}

+ 0 - 43
test/std/experimental/optional/optional.object/optional.object.observe/op_arrow.pass.cpp

@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// constexpr T* optional<T>::operator->();
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
-    constexpr int test() const {return 3;}
-};
-
-int main()
-{
-    {
-        constexpr optional<X> opt(X{});
-        static_assert(opt->test() == 3, "");
-    }
-#ifdef _LIBCPP_DEBUG
-    {
-        optional<X> opt;
-        assert(opt->test() == 3);
-        assert(false);
-    }
-#endif  // _LIBCPP_DEBUG
-}

+ 0 - 65
test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp

@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// constexpr const T* optional<T>::operator->() const;
-
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
-    constexpr int test() const {return 3;}
-};
-
-struct Y
-{
-    int test() const {return 2;}
-};
-
-struct Z
-{
-    const Z* operator&() const {return this;}
-    constexpr int test() const {return 1;}
-};
-
-int main()
-{
-    {
-        constexpr optional<X> opt(X{});
-        static_assert(opt->test() == 3, "");
-    }
-    {
-        constexpr optional<Y> opt(Y{});
-        assert(opt->test() == 2);
-    }
-    {
-        constexpr optional<Z> opt(Z{});
-        assert(opt->test() == 1);
-#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
-        static_assert(opt->test() == 1, "");
-#endif
-    }
-#ifdef _LIBCPP_DEBUG
-    {
-        const optional<X> opt;
-        assert(opt->test() == 3);
-        assert(false);
-    }
-#endif  // _LIBCPP_DEBUG
-}

+ 0 - 59
test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp

@@ -1,59 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// <optional>
-
-// T& optional<T>::value();
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-using std::experimental::bad_optional_access;
-
-struct X
-{
-    X() = default;
-    X(const X&) = delete;
-    constexpr int test() const {return 3;}
-    int test() {return 4;}
-};
-
-int main()
-{
-    {
-        optional<X> opt;
-        opt.emplace();
-        assert(opt.value().test() == 4);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        optional<X> opt;
-        try
-        {
-            opt.value();
-            assert(false);
-        }
-        catch (const bad_optional_access&)
-        {
-        }
-    }
-#endif
-}

+ 0 - 33
test/std/experimental/optional/optional.object/optional.object.observe/value_const.fail.cpp

@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// constexpr const T& optional<T>::value() const;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
-    constexpr int test() const {return 3;}
-    int test() {return 4;}
-};
-
-int main()
-{
-    {
-        constexpr optional<X> opt;
-        static_assert(opt.value().test() == 3, "");
-    }
-}

+ 0 - 64
test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp

@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// <optional>
-
-// constexpr const T& optional<T>::value() const;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-using std::experimental::in_place_t;
-using std::experimental::in_place;
-using std::experimental::bad_optional_access;
-
-struct X
-{
-    X() = default;
-    X(const X&) = delete;
-   constexpr int test() const {return 3;}
-    int test() {return 4;}
-};
-
-int main()
-{
-    {
-        constexpr optional<X> opt(in_place);
-        static_assert(opt.value().test() == 3, "");
-    }
-    {
-        const optional<X> opt(in_place);
-        assert(opt.value().test() == 3);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        const optional<X> opt;
-        try
-        {
-            opt.value();
-            assert(false);
-        }
-        catch (const bad_optional_access&)
-        {
-        }
-    }
-#endif
-}

+ 0 - 66
test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp

@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class U> T optional<T>::value_or(U&& v) &&;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-using std::experimental::in_place_t;
-using std::experimental::in_place;
-
-struct Y
-{
-    int i_;
-
-    Y(int i) : i_(i) {}
-};
-
-struct X
-{
-    int i_;
-
-    X(int i) : i_(i) {}
-    X(X&& x) : i_(x.i_) {x.i_ = 0;}
-    X(const Y& y) : i_(y.i_) {}
-    X(Y&& y) : i_(y.i_+1) {}
-    friend constexpr bool operator==(const X& x, const X& y)
-        {return x.i_ == y.i_;}
-};
-
-int main()
-{
-    {
-        optional<X> opt(in_place, 2);
-        Y y(3);
-        assert(std::move(opt).value_or(y) == 2);
-        assert(*opt == 0);
-    }
-    {
-        optional<X> opt(in_place, 2);
-        assert(std::move(opt).value_or(Y(3)) == 2);
-        assert(*opt == 0);
-    }
-    {
-        optional<X> opt;
-        Y y(3);
-        assert(std::move(opt).value_or(y) == 3);
-        assert(!opt);
-    }
-    {
-        optional<X> opt;
-        assert(std::move(opt).value_or(Y(3)) == 4);
-        assert(!opt);
-    }
-}

+ 0 - 77
test/std/experimental/optional/optional.object/optional.object.observe/value_or_const.pass.cpp

@@ -1,77 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class U> constexpr T optional<T>::value_or(U&& v) const&;
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct Y
-{
-    int i_;
-
-    constexpr Y(int i) : i_(i) {}
-};
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-    constexpr X(const Y& y) : i_(y.i_) {}
-    constexpr X(Y&& y) : i_(y.i_+1) {}
-    friend constexpr bool operator==(const X& x, const X& y)
-        {return x.i_ == y.i_;}
-};
-
-int main()
-{
-    {
-        constexpr optional<X> opt(2);
-        constexpr Y y(3);
-        static_assert(opt.value_or(y) == 2, "");
-    }
-    {
-        constexpr optional<X> opt(2);
-        static_assert(opt.value_or(Y(3)) == 2, "");
-    }
-    {
-        constexpr optional<X> opt;
-        constexpr Y y(3);
-        static_assert(opt.value_or(y) == 3, "");
-    }
-    {
-        constexpr optional<X> opt;
-        static_assert(opt.value_or(Y(3)) == 4, "");
-    }
-    {
-        const optional<X> opt(2);
-        const Y y(3);
-        assert(opt.value_or(y) == 2);
-    }
-    {
-        const optional<X> opt(2);
-        assert(opt.value_or(Y(3)) == 2);
-    }
-    {
-        const optional<X> opt;
-        const Y y(3);
-        assert(opt.value_or(y) == 3);
-    }
-    {
-        const optional<X> opt;
-        assert(opt.value_or(Y(3)) == 4);
-    }
-}

+ 0 - 313
test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp

@@ -1,313 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// void swap(optional&)
-//     noexcept(is_nothrow_move_constructible<T>::value &&
-//              noexcept(swap(declval<T&>(), declval<T&>())));
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-class X
-{
-    int i_;
-public:
-    static unsigned dtor_called;
-    X(int i) : i_(i) {}
-    X(X&& x) = default;
-    X& operator=(X&&) = default;
-    ~X() {++dtor_called;}
-
-    friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
-};
-
-unsigned X::dtor_called = 0;
-
-class Y
-{
-    int i_;
-public:
-    static unsigned dtor_called;
-    Y(int i) : i_(i) {}
-    Y(Y&&) = default;
-    ~Y() {++dtor_called;}
-
-    friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
-    friend void swap(Y& x, Y& y) {std::swap(x.i_, y.i_);}
-};
-
-unsigned Y::dtor_called = 0;
-
-class Z
-{
-    int i_;
-public:
-    Z(int i) : i_(i) {}
-    Z(Z&&) {TEST_THROW(7);}
-
-    friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
-    friend void swap(Z&, Z&) {TEST_THROW(6);}
-};
-
-struct ConstSwappable {
-};
-void swap(ConstSwappable const&, ConstSwappable const&) {}
-
-int main()
-{
-    {
-        optional<int> opt1;
-        optional<int> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        opt1.swap(opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<int> opt1(1);
-        optional<int> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        opt1.swap(opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<int> opt1;
-        optional<int> opt2(2);
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        opt1.swap(opt2);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<int> opt1(1);
-        optional<int> opt2(2);
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        opt1.swap(opt2);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<const ConstSwappable> opt;
-        optional<const ConstSwappable> opt2;
-        opt.swap(opt2);
-    }
-    {
-        optional<X> opt1;
-        optional<X> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        opt1.swap(opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        assert(X::dtor_called == 0);
-    }
-    {
-        optional<X> opt1(1);
-        optional<X> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        X::dtor_called = 0;
-        opt1.swap(opt2);
-        assert(X::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<X> opt1;
-        optional<X> opt2(2);
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        X::dtor_called = 0;
-        opt1.swap(opt2);
-        assert(X::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<X> opt1(1);
-        optional<X> opt2(2);
-        static_assert(noexcept(opt1.swap(opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        X::dtor_called = 0;
-        opt1.swap(opt2);
-        assert(X::dtor_called == 1);  // from inside std::swap
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<Y> opt1;
-        optional<Y> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        opt1.swap(opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        assert(Y::dtor_called == 0);
-    }
-    {
-        optional<Y> opt1(1);
-        optional<Y> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        Y::dtor_called = 0;
-        opt1.swap(opt2);
-        assert(Y::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<Y> opt1;
-        optional<Y> opt2(2);
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        Y::dtor_called = 0;
-        opt1.swap(opt2);
-        assert(Y::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<Y> opt1(1);
-        optional<Y> opt2(2);
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        Y::dtor_called = 0;
-        opt1.swap(opt2);
-        assert(Y::dtor_called == 0);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        optional<Z> opt1;
-        optional<Z> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        opt1.swap(opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<Z> opt1;
-        opt1.emplace(1);
-        optional<Z> opt2;
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        try
-        {
-            opt1.swap(opt2);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 7);
-        }
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<Z> opt1;
-        optional<Z> opt2;
-        opt2.emplace(2);
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        try
-        {
-            opt1.swap(opt2);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 7);
-        }
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-    }
-    {
-        optional<Z> opt1;
-        opt1.emplace(1);
-        optional<Z> opt2;
-        opt2.emplace(2);
-        static_assert(noexcept(opt1.swap(opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        try
-        {
-            opt1.swap(opt2);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-        }
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-    }
-#endif
-}

+ 0 - 22
test/std/experimental/optional/optional.object/optional_const_void.fail.cpp

@@ -1,22 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// T shall be an object type and shall satisfy the requirements of Destructible
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-
-    optional<const void> opt;
-}

+ 0 - 28
test/std/experimental/optional/optional.object/optional_not_destructible.fail.cpp

@@ -1,28 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// T shall be an object type and shall satisfy the requirements of Destructible
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-private:
-    ~X() {}
-};
-
-int main()
-{
-    optional<X> opt;
-}

+ 0 - 27
test/std/experimental/optional/optional.object/optional_not_noexcept_destructible.fail.cpp

@@ -1,27 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// T shall be an object type and shall satisfy the requirements of Destructible
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    ~X() noexcept(false) {}
-};
-
-int main()
-{
-    optional<X> opt;
-}

+ 0 - 22
test/std/experimental/optional/optional.object/optional_void.fail.cpp

@@ -1,22 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// T shall be an object type and shall satisfy the requirements of Destructible
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-
-    optional<void> opt;
-}

+ 0 - 38
test/std/experimental/optional/optional.object/types.pass.cpp

@@ -1,38 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T>
-// class optional
-// {
-// public:
-//     typedef T value_type;
-//     ...
-
-#include <experimental/optional>
-#include <type_traits>
-
-using std::experimental::optional;
-
-template <class Opt, class T>
-void
-test()
-{
-    static_assert(std::is_same<typename Opt::value_type, T>::value, "");
-}
-
-int main()
-{
-    test<optional<int>, int>();
-    test<optional<const int>, const int>();
-    test<optional<double>, double>();
-    test<optional<const double>, const double>();
-}

+ 0 - 74
test/std/experimental/optional/optional.relops/equal.pass.cpp

@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator == ( const X &lhs, const X &rhs )
-    { return lhs.i_ == rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2;     // disengaged
-    constexpr O o3{1};  // engaged
-    constexpr O o4{2};  // engaged
-    constexpr O o5{1};  // engaged
-
-    static_assert (   o1 == o1 , "" );
-    static_assert (   o1 == o2 , "" );
-    static_assert ( !(o1 == o3), "" );
-    static_assert ( !(o1 == o4), "" );
-    static_assert ( !(o1 == o5), "" );
-
-    static_assert (   o2 == o1 , "" );
-    static_assert (   o2 == o2 , "" );
-    static_assert ( !(o2 == o3), "" );
-    static_assert ( !(o2 == o4), "" );
-    static_assert ( !(o2 == o5), "" );
-
-    static_assert ( !(o3 == o1), "" );
-    static_assert ( !(o3 == o2), "" );
-    static_assert (   o3 == o3 , "" );
-    static_assert ( !(o3 == o4), "" );
-    static_assert (   o3 == o5 , "" );
-
-    static_assert ( !(o4 == o1), "" );
-    static_assert ( !(o4 == o2), "" );
-    static_assert ( !(o4 == o3), "" );
-    static_assert (   o4 == o4 , "" );
-    static_assert ( !(o4 == o5), "" );
-
-    static_assert ( !(o5 == o1), "" );
-    static_assert ( !(o5 == o2), "" );
-    static_assert (   o5 == o3 , "" );
-    static_assert ( !(o5 == o4), "" );
-    static_assert (   o5 == o5 , "" );
-
-    }
-}

+ 0 - 70
test/std/experimental/optional/optional.relops/greater_equal.pass.cpp

@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator>= (const optional<T>& x, const optional<T>& y);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef optional<X> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2;     // disengaged
-    constexpr O o3{1};  // engaged
-    constexpr O o4{2};  // engaged
-    constexpr O o5{1};  // engaged
-
-    static_assert (  (o1 >= o1), "" );
-    static_assert (  (o1 >= o2), "" );
-    static_assert ( !(o1 >= o3), "" );
-    static_assert ( !(o1 >= o4), "" );
-    static_assert ( !(o1 >= o5), "" );
-
-    static_assert (  (o2 >= o1), "" );
-    static_assert (  (o2 >= o2), "" );
-    static_assert ( !(o2 >= o3), "" );
-    static_assert ( !(o2 >= o4), "" );
-    static_assert ( !(o2 >= o5), "" );
-
-    static_assert (  (o3 >= o1), "" );
-    static_assert (  (o3 >= o2), "" );
-    static_assert (  (o3 >= o3), "" );
-    static_assert ( !(o3 >= o4), "" );
-    static_assert (  (o3 >= o5), "" );
-
-    static_assert (  (o4 >= o1), "" );
-    static_assert (  (o4 >= o2), "" );
-    static_assert (  (o4 >= o3), "" );
-    static_assert (  (o4 >= o4), "" );
-    static_assert (  (o4 >= o5), "" );
-
-    static_assert (  (o5 >= o1), "" );
-    static_assert (  (o5 >= o2), "" );
-    static_assert (  (o5 >= o3), "" );
-    static_assert ( !(o5 >= o4), "" );
-    static_assert (  (o5 >= o5), "" );
-    }
-}

+ 0 - 70
test/std/experimental/optional/optional.relops/greater_than.pass.cpp

@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator> (const optional<T>& x, const optional<T>& y);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef optional<X> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2;     // disengaged
-    constexpr O o3{1};  // engaged
-    constexpr O o4{2};  // engaged
-    constexpr O o5{1};  // engaged
-
-    static_assert ( !(o1 > o1), "" );
-    static_assert ( !(o1 > o2), "" );
-    static_assert ( !(o1 > o3), "" );
-    static_assert ( !(o1 > o4), "" );
-    static_assert ( !(o1 > o5), "" );
-
-    static_assert ( !(o2 > o1), "" );
-    static_assert ( !(o2 > o2), "" );
-    static_assert ( !(o2 > o3), "" );
-    static_assert ( !(o2 > o4), "" );
-    static_assert ( !(o2 > o5), "" );
-
-    static_assert (  (o3 > o1), "" );
-    static_assert (  (o3 > o2), "" );
-    static_assert ( !(o3 > o3), "" );
-    static_assert ( !(o3 > o4), "" );
-    static_assert ( !(o3 > o5), "" );
-
-    static_assert (  (o4 > o1), "" );
-    static_assert (  (o4 > o2), "" );
-    static_assert (  (o4 > o3), "" );
-    static_assert ( !(o4 > o4), "" );
-    static_assert (  (o4 > o5), "" );
-
-    static_assert (  (o5 > o1), "" );
-    static_assert (  (o5 > o2), "" );
-    static_assert ( !(o5 > o3), "" );
-    static_assert ( !(o5 > o4), "" );
-    static_assert ( !(o5 > o5), "" );
-    }
-}

+ 0 - 70
test/std/experimental/optional/optional.relops/less_equal.pass.cpp

@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator<= (const optional<T>& x, const optional<T>& y);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef optional<X> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2;     // disengaged
-    constexpr O o3{1};  // engaged
-    constexpr O o4{2};  // engaged
-    constexpr O o5{1};  // engaged
-
-    static_assert (  (o1 <= o1), "" );
-    static_assert (  (o1 <= o2), "" );
-    static_assert (  (o1 <= o3), "" );
-    static_assert (  (o1 <= o4), "" );
-    static_assert (  (o1 <= o5), "" );
-
-    static_assert (  (o2 <= o1), "" );
-    static_assert (  (o2 <= o2), "" );
-    static_assert (  (o2 <= o3), "" );
-    static_assert (  (o2 <= o4), "" );
-    static_assert (  (o2 <= o5), "" );
-
-    static_assert ( !(o3 <= o1), "" );
-    static_assert ( !(o3 <= o2), "" );
-    static_assert (  (o3 <= o3), "" );
-    static_assert (  (o3 <= o4), "" );
-    static_assert (  (o3 <= o5), "" );
-
-    static_assert ( !(o4 <= o1), "" );
-    static_assert ( !(o4 <= o2), "" );
-    static_assert ( !(o4 <= o3), "" );
-    static_assert (  (o4 <= o4), "" );
-    static_assert ( !(o4 <= o5), "" );
-
-    static_assert ( !(o5 <= o1), "" );
-    static_assert ( !(o5 <= o2), "" );
-    static_assert (  (o5 <= o3), "" );
-    static_assert (  (o5 <= o4), "" );
-    static_assert (  (o5 <= o5), "" );
-    }
-}

+ 0 - 70
test/std/experimental/optional/optional.relops/less_than.pass.cpp

@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator< (const optional<T>& x, const optional<T>& y);
-
-#include <experimental/optional>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator < ( const X &lhs, const X &rhs )
-    { return lhs.i_ < rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef optional<X> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2;     // disengaged
-    constexpr O o3{1};  // engaged
-    constexpr O o4{2};  // engaged
-    constexpr O o5{1};  // engaged
-
-    static_assert ( !(o1 < o1), "" );
-    static_assert ( !(o1 < o2), "" );
-    static_assert (  (o1 < o3), "" );
-    static_assert (  (o1 < o4), "" );
-    static_assert (  (o1 < o5), "" );
-
-    static_assert ( !(o2 < o1), "" );
-    static_assert ( !(o2 < o2), "" );
-    static_assert (  (o2 < o3), "" );
-    static_assert (  (o2 < o4), "" );
-    static_assert (  (o2 < o5), "" );
-
-    static_assert ( !(o3 < o1), "" );
-    static_assert ( !(o3 < o2), "" );
-    static_assert ( !(o3 < o3), "" );
-    static_assert (  (o3 < o4), "" );
-    static_assert ( !(o3 < o5), "" );
-
-    static_assert ( !(o4 < o1), "" );
-    static_assert ( !(o4 < o2), "" );
-    static_assert ( !(o4 < o3), "" );
-    static_assert ( !(o4 < o4), "" );
-    static_assert ( !(o4 < o5), "" );
-
-    static_assert ( !(o5 < o1), "" );
-    static_assert ( !(o5 < o2), "" );
-    static_assert ( !(o5 < o3), "" );
-    static_assert (  (o5 < o4), "" );
-    static_assert ( !(o5 < o5), "" );
-    }
-}

+ 0 - 74
test/std/experimental/optional/optional.relops/not_equal.pass.cpp

@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y);
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-using std::experimental::optional;
-
-struct X
-{
-    int i_;
-
-    constexpr X(int i) : i_(i) {}
-};
-
-constexpr bool operator == ( const X &lhs, const X &rhs )
-    { return lhs.i_ == rhs.i_ ; }
-
-int main()
-{
-    {
-    typedef X T;
-    typedef optional<T> O;
-
-    constexpr O o1;     // disengaged
-    constexpr O o2;     // disengaged
-    constexpr O o3{1};  // engaged
-    constexpr O o4{2};  // engaged
-    constexpr O o5{1};  // engaged
-
-    static_assert ( !(o1 != o1), "" );
-    static_assert ( !(o1 != o2), "" );
-    static_assert (  (o1 != o3), "" );
-    static_assert (  (o1 != o4), "" );
-    static_assert (  (o1 != o5), "" );
-
-    static_assert ( !(o2 != o1), "" );
-    static_assert ( !(o2 != o2), "" );
-    static_assert (  (o2 != o3), "" );
-    static_assert (  (o2 != o4), "" );
-    static_assert (  (o2 != o5), "" );
-
-    static_assert (  (o3 != o1), "" );
-    static_assert (  (o3 != o2), "" );
-    static_assert ( !(o3 != o3), "" );
-    static_assert (  (o3 != o4), "" );
-    static_assert ( !(o3 != o5), "" );
-
-    static_assert (  (o4 != o1), "" );
-    static_assert (  (o4 != o2), "" );
-    static_assert (  (o4 != o3), "" );
-    static_assert ( !(o4 != o4), "" );
-    static_assert (  (o4 != o5), "" );
-
-    static_assert (  (o5 != o1), "" );
-    static_assert (  (o5 != o2), "" );
-    static_assert ( !(o5 != o3), "" );
-    static_assert (  (o5 != o4), "" );
-    static_assert ( !(o5 != o5), "" );
-
-    }
-}

+ 0 - 51
test/std/experimental/optional/optional.specalg/make_optional.pass.cpp

@@ -1,51 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T>
-//   constexpr
-//   optional<typename decay<T>::type>
-//   make_optional(T&& v);
-
-#include <experimental/optional>
-#include <string>
-#include <memory>
-#include <cassert>
-
-#include "test_macros.h"
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::make_optional;
-
-    {
-        optional<int> opt = make_optional(2);
-        assert(*opt == 2);
-    }
-    {
-        std::string s("123");
-        optional<std::string> opt = make_optional(s);
-        assert(*opt == s);
-    }
-    {
-        std::string s("123");
-        optional<std::string> opt = make_optional(std::move(s));
-        assert(*opt == "123");
-        LIBCPP_ASSERT(s.empty());
-    }
-    {
-        std::unique_ptr<int> s(new int(3));
-        optional<std::unique_ptr<int>> opt = make_optional(std::move(s));
-        assert(**opt == 3);
-        assert(s == nullptr);
-    }
-}

+ 0 - 303
test/std/experimental/optional/optional.specalg/swap.pass.cpp

@@ -1,303 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// template <class T> void swap(optional<T>& x, optional<T>& y)
-//     noexcept(noexcept(x.swap(y)));
-
-#include <experimental/optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-using std::experimental::optional;
-
-class X
-{
-    int i_;
-public:
-    static unsigned dtor_called;
-    X(int i) : i_(i) {}
-    X(X&& x) = default;
-    X& operator=(X&&) = default;
-    ~X() {++dtor_called;}
-
-    friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
-};
-
-unsigned X::dtor_called = 0;
-
-class Y
-{
-    int i_;
-public:
-    static unsigned dtor_called;
-    Y(int i) : i_(i) {}
-    Y(Y&&) = default;
-    ~Y() {++dtor_called;}
-
-    friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
-    friend void swap(Y& x, Y& y) {std::swap(x.i_, y.i_);}
-};
-
-unsigned Y::dtor_called = 0;
-
-class Z
-{
-    int i_;
-public:
-    Z(int i) : i_(i) {}
-    Z(Z&&) {TEST_THROW(7);}
-
-    friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
-    friend void swap(Z&, Z&) {TEST_THROW(6);}
-};
-
-int main()
-{
-    {
-        optional<int> opt1;
-        optional<int> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        swap(opt1, opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<int> opt1(1);
-        optional<int> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        swap(opt1, opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<int> opt1;
-        optional<int> opt2(2);
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        swap(opt1, opt2);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<int> opt1(1);
-        optional<int> opt2(2);
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        swap(opt1, opt2);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<X> opt1;
-        optional<X> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        swap(opt1, opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        assert(X::dtor_called == 0);
-    }
-    {
-        optional<X> opt1(1);
-        optional<X> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        X::dtor_called = 0;
-        swap(opt1, opt2);
-        assert(X::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<X> opt1;
-        optional<X> opt2(2);
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        X::dtor_called = 0;
-        swap(opt1, opt2);
-        assert(X::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<X> opt1(1);
-        optional<X> opt2(2);
-        static_assert(noexcept(swap(opt1, opt2)) == true, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        X::dtor_called = 0;
-        swap(opt1, opt2);
-        assert(X::dtor_called == 1);  // from inside std::swap
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<Y> opt1;
-        optional<Y> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        swap(opt1, opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        assert(Y::dtor_called == 0);
-    }
-    {
-        optional<Y> opt1(1);
-        optional<Y> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        Y::dtor_called = 0;
-        swap(opt1, opt2);
-        assert(Y::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<Y> opt1;
-        optional<Y> opt2(2);
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        Y::dtor_called = 0;
-        swap(opt1, opt2);
-        assert(Y::dtor_called == 1);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<Y> opt1(1);
-        optional<Y> opt2(2);
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        Y::dtor_called = 0;
-        swap(opt1, opt2);
-        assert(Y::dtor_called == 0);
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 2);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 1);
-    }
-    {
-        optional<Z> opt1;
-        optional<Z> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-        swap(opt1, opt2);
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == false);
-    }
-#ifndef TEST_HAS_NO_EXCEPTIONS
-    {
-        optional<Z> opt1;
-        opt1.emplace(1);
-        optional<Z> opt2;
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-        try
-        {
-            swap(opt1, opt2);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 7);
-        }
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == false);
-    }
-    {
-        optional<Z> opt1;
-        optional<Z> opt2;
-        opt2.emplace(2);
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        try
-        {
-            swap(opt1, opt2);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 7);
-        }
-        assert(static_cast<bool>(opt1) == false);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-    }
-    {
-        optional<Z> opt1;
-        opt1.emplace(1);
-        optional<Z> opt2;
-        opt2.emplace(2);
-        static_assert(noexcept(swap(opt1, opt2)) == false, "");
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-        try
-        {
-            swap(opt1, opt2);
-            assert(false);
-        }
-        catch (int i)
-        {
-            assert(i == 6);
-        }
-        assert(static_cast<bool>(opt1) == true);
-        assert(*opt1 == 1);
-        assert(static_cast<bool>(opt2) == true);
-        assert(*opt2 == 2);
-    }
-#endif  // TEST_HAS_NO_EXCEPTIONS
-}

+ 0 - 25
test/std/experimental/optional/optional.syn/optional_const_in_place_t.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <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()
-{
-    using std::experimental::optional;
-    using std::experimental::in_place_t;
-    using std::experimental::in_place;
-
-    optional<const in_place_t> opt;
-}

+ 0 - 23
test/std/experimental/optional/optional.syn/optional_const_lvalue_ref.fail.cpp

@@ -1,23 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// A program that necessitates the instantiation of template optional for a
-// reference type is ill-formed.
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-
-    optional<const int&> opt;
-}

+ 0 - 25
test/std/experimental/optional/optional.syn/optional_const_nullopt_t.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// A program that necessitates the instantiation of template optional for
-// (possibly cv-qualified) nullopt_t is ill-formed.
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    optional<const nullopt_t> opt;
-}

+ 0 - 25
test/std/experimental/optional/optional.syn/optional_in_place_t.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <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()
-{
-    using std::experimental::optional;
-    using std::experimental::in_place_t;
-    using std::experimental::in_place;
-
-    optional<in_place_t> opt;
-}

+ 0 - 23
test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp

@@ -1,23 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// #include <initializer_list>
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-
-    std::initializer_list<int> list;
-    (void)list;
-}

+ 0 - 23
test/std/experimental/optional/optional.syn/optional_lvalue_ref.fail.cpp

@@ -1,23 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// A program that necessitates the instantiation of template optional for a
-// reference type is ill-formed.
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-
-    optional<int&> opt;
-}

+ 0 - 25
test/std/experimental/optional/optional.syn/optional_nullopt_t.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// A program that necessitates the instantiation of template optional for
-// (possibly cv-qualified) nullopt_t is ill-formed.
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-    using std::experimental::nullopt_t;
-    using std::experimental::nullopt;
-
-    optional<nullopt_t> opt;
-}

+ 0 - 23
test/std/experimental/optional/optional.syn/optional_rvalue_ref.fail.cpp

@@ -1,23 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     The 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
-// <optional>
-
-// A program that necessitates the instantiation of template optional for a
-// reference type is ill-formed.
-
-#include <experimental/optional>
-
-int main()
-{
-    using std::experimental::optional;
-
-    optional<int&&> opt;
-}