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