| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 3 |
// See https://llvm.org/LICENSE.txt for license information. |
| 4 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 5 |
// |
| 6 |
//===----------------------------------------------------------------------===// |
| 7 |
|
| 8 |
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 |
| 9 |
|
| 10 |
// explicit bad_expected_access(E e); |
| 11 |
|
| 12 |
// Effects: Initializes unex with std::move(e). |
| 13 |
|
| 14 |
#include <cassert> |
| 15 |
#include <concepts> |
| 16 |
#include <expected> |
| 17 |
#include <utility> |
| 18 |
|
| 19 |
#include "test_macros.h" |
| 20 |
#include "MoveOnly.h" |
| 21 |
|
| 22 |
// test explicit |
| 23 |
static_assert(std::convertible_to<int, int>); |
| 24 |
static_assert(!std::convertible_to<int, std::bad_expected_access<int>>); |
| 25 |
|
| 26 |
int main(int, char**) { |
| 27 |
std::bad_expected_access<MoveOnly> b(MoveOnly{3}); |
| 28 |
assert(b.error().get() == 3); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |