#include <cassert>
#include <expected>
#include <type_traits>
#include "test_macros.h"
struct NoDefaultCtor {
constexpr NoDefaultCtor() = delete;
};
static_assert(std::is_nothrow_default_constructible_v<std::expected<void, int>>);
static_assert(std::is_nothrow_default_constructible_v<std::expected<void, NoDefaultCtor>>);
struct MyInt {
int i;
friend constexpr bool operator==(const MyInt&, const MyInt&) = default;
};
constexpr bool test() {
{
std::expected<void, int> e;
assert(e.has_value());
}
{
std::expected<void, NoDefaultCtor> e;
assert(e.has_value());
}
return true;
}
int main(int, char**) {
test();
static_assert(test());
return 0;
}