public:
constexpr Z() : i_(0) {}
constexpr Z(int i) : i_(i) {}
- constexpr Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
+ Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
{throw 6;}
friend constexpr bool operator==(const Z& x, const Z& y)
: optional<Y>(in_place, i) {}
};
+ constexpr test_constexpr_ctor dopt(in_place, {42, 101, -1});
+ static_assert(*dopt == Y{42, 101, -1}, "");
}
{
static_assert(std::is_constructible<optional<Z>, std::initializer_list<int>&>::value, "");
{
assert(i == 6);
}
-
- struct test_constexpr_ctor
- : public optional<Z>
- {
- constexpr test_constexpr_ctor(in_place_t, std::initializer_list<int> i)
- : optional<Z>(in_place, i) {}
- };
-
}
}
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
using std::experimental::optional;
std::string s("123");
optional<std::string> opt = make_optional(std::move(s));
assert(*opt == "123");
- assert(s.empty());
+ LIBCPP_ASSERT(s.empty());
}
{
std::unique_ptr<int> s(new int(3));